Show different tab text per language #
If your store runs WPML or Polylang, the [alg_wc_pt_translate] shortcode in Additional Custom Product Tabs for WooCommerce lets one tab display the right text for each visitor’s language. This is useful for global tabs, where a single tab shows on every product across all languages. The shortcode is free.
Before you start #
- WPML or Polylang active, so a current language code is available.
- A tab to edit, in WPFactory > Product Tabs (also reachable at WooCommerce > Settings > Product Tabs) or in a product’s Custom Product Tabs meta box.
Syntax 1: attributes #
Provide the target languages and both text versions as attributes:
[alg_wc_pt_translate lang="EN,DE" lang_text="Text for English and German" not_lang_text="Text for other languages"]
When the active language is one of those in lang, the lang_text is shown. Otherwise the not_lang_text is shown.
Syntax 2: enclosing tags #
Wrap each language block in its own shortcode pair. Use lang to show a block only for listed languages, or not_lang to show it for all except the listed languages:
[alg_wc_pt_translate lang="EN,DE"]Text for English and German[/alg_wc_pt_translate]
[alg_wc_pt_translate not_lang="EN,DE"]Text for other languages[/alg_wc_pt_translate]
Shortcodes inside the enclosed text are processed too, so you can nest the product data shortcodes within a language block.
How the language is matched #
The shortcode compares your lang list against the active WPML or Polylang language code (for example en, de). Matching is case-insensitive and the list is comma separated. If no multilingual plugin is active, the “other languages” text is used.
Note on the deprecated alias #
Older content may use [alg_wc_cpt_translate]. It still works as an alias, but use [alg_wc_pt_translate] going forward.
Troubleshooting #
- Always shows the “other languages” text: confirm WPML or Polylang is active and that your language codes in
langmatch the site’s codes. - Both versions show: check that your opening and closing tags are paired correctly in Syntax 2.
Get more control #
Multilingual tabs are free. When one global tab is not enough, Additional Custom Product Tabs for WooCommerce Pro adds unlimited tabs. See what Pro unlocks.