Using Polylang to translate Woocommerce simple products is quite straightforward. But for variable products, it is a bit tricky.
In this article, you will see steps by steps how to use Polylang to translate Woocommerce variable products.
Polylang and Woocommerce
Polylang is a plugin to have your website in multilanguage as it lets users create translated versions of pages, posts, media, categories, tags, and also other custom post types and taxonomies. For SEO benefits, the Polylang free version also translate slugs.
But, to have Polylang enabled for Woocommerce products, you will need an extra plugin: Polylang for Woocommerce. And, also, you need to have Polylang Pro to have this plugin work.
It is quite straighforward how to translate simple products. However, for variable products, Polylang for Woocommerce plugin synchronizes all variations and attributes over different versions of languages so it needs more steps to make the translation happen.
What are variable products?
Sometimes a product has variations. For example if you are selling shirts, the variations might be sizes, colors, and gender. It lets user select exactly the style of product they wish to have, that you are able to provide.
For example, Mr. A wants to buy a blue XL shirt, while Ms. B needs the same looking shirt in pink XS. It is defined as one product, but variations.
How to use Polylang to translate Woocommerce variable products
You would need to use global attributes to have translated versions of product variations.
What are global attributes?
As the name said, global attributes are attributes that used over different products.
For example, if you want to use the same variation of color for both a shirt and a hoodie (meaning that in both products, users can choose color), it would save time to create global attributes and load it into both of these products. So you don’t need to manually create a variation of color each time you want to include this variation in one product.
Translating Woocommerce variable products
Use Case
Let me explain the use case a bit that you can follow the below instructions.
Here I have a product: Fixation adapter for silencer (sorry for this not-so-common product).
I would like to have variations for this product like:
- Ruger Mark II-III bajonet adapter
- Browning Buck Mark bajonet adapter
- Sig Sauer Mosquito .22 adapter
And I would like to have these variations translated to Finnish, German and French.
How to do it
Step 1: Create a global attribute
From WordPress Dashboard column: Products > Attributes.
Create a global attribute in Woocommerce
You can add a new attribute by filling in the Name field and click Add attribute.
As you see from the right section of the page, I already created a global attribute name Valitse tuote (meaning Choose Product in English).
Step 2. Add a new term in the global attribute
Click to Valitse tuote (or any name you have) from the right part of the page to start adding terms. Or, click Configure terms.
Adding a new term for a global attribute, woocommerce
Start adding a new term in the original language, in my case is Finnish. You will then see it appears in the right section of the page.
Step 3. Add a translated version for the term you’ve just added
Click to the + sign next to a term you want to have translated version. Filling in the Name field and click Add new {attribute-name} button
To make sure that you are creating a translated version of a term, not just a new term which does not link anywhere, check the Translations part in the left side, it has to show early translated version of the same term.
This part has to show early translated version of the same term.
For so many times I forgot to check this, resulting in many orphaned terms that do not link anywhere. So be carefully do this step!
If a term has translated versions, it will show the Pen sign.
Step 4. Loading the global attribute in a variable product
From a single product editor, in Product data tab:
- Set the Product data to Variable product
- Select Attributes tab
- Choose the global attribute in the dropdown list. In my case is Valitse tuote →
- Click Add
Loading the global attribute in a variable product
After the attribute has been loaded into the view, next step:
- Tick on Used for variations
- Select as many terms as you like from the Value(s) field by start typing in the term name
- Click Save attributes
Select global attribute terms for variable products
Now that the terms have been added to this single product. Next:
- Choose Variations tab
- Select from the dropdown list Create variations from all attributes
- Click Go
- Wait that the variations are loaded into the view
Create variations for variable products in Woocommerce
Attributes terms load successfully into the view
Next, click to the number (e.g #2518 in this case) to open a dialog and start filling in information for that specific variation (for example price, weight, dimensions, and so on).
Set specific information for a single product variation
After you are happy with the information, click Save changes.
Then, click Update from the product editor.
Update the product
Step 5. Translate the global attribute name
So far we have translated the global attribute terms. How about the name? You can find the global attributes to translate from WP Dashboard column > Languages > String translations.
Using Polylang String translations to translate Woocommerce global attribute
Step 6. Review the changes
View the product and switch to different languages to see if the translated terms have been understand correctly.
View Polylang translated version of variable products in English and German
Troubleshooting
As I follow the process, there are some notices I would like to share with you.
The process to translate terms in global attributes brings headaches.
Really, it creates me severe headache when translating a term in 4 languages. Starting with creating a new term for the original language, then click the + sign to add translated version x 3 times.
And then at a time, the Cache suddenly starts to prove its value and the list does not show the term translation state correctly. If you don’t see the terms, you can try to purge the cache.
If you add a term several times and still don’t see it displayed in the list, probably you are in the wrong languages. Because, if you switch language in any other page, all the system language will be changed following that.
Make sure that you are in the correct language state