Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are developing a site and using the WooCommerce API to import categories, attributes, and products. However, you've encountered an issue where attributes can't be translated over the API, and attributes created through the API are monolingual, making their terms untranslatable. You are looking for a way to translate attribute names using a PHP script.
Solution:
Currently, it is not possible to translate attribute names through the API. You can create attributes using this guide, but to translate the attribute names, you must do it manually. Go to "WooCommerce → WooCommerce Multilingual & Multicurrency", under the Attributes tab, scroll down to the "Translations of taxonomy labels and slugs" section and add the translations there. Although this may not be the ideal solution, it is the only method available at this time. We are aware of this limitation and are hoping to include support for translating attribute labels and names in future versions of WCML.

If this solution does not resolve your issue or seems outdated, we recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 1 voice.

Last updated by Prosenjit Barman 5 days, 10 hours ago.

Assisted by: Prosenjit Barman.

Author Posts
November 21, 2024 at 12:54 pm #16429077

newcomS

Background of the issue:
I am developing a site and writing a script to import categories, attributes, and products. I am using the WooCommerce API for this process.

Symptoms:
Attributes can't be translated over the WooCommerce API, and attributes created through the API are monolingual, making their terms untranslatable.

Questions:
Is there another way to translate attributes other than manually in the UI?
Is there a way to create attributes that are translatable, like those created in the UI?

November 21, 2024 at 3:53 pm #16430108

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

Have you also reviewed our WooCommerce Multilingual API documentation? It includes a guide on working with local and global attributes: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/.

Please be also aware of section:

Please note that you can use the REST API to translate Attribute terms (e.g. Blue), but not Attribute names (e.g. Color). To translate Attribute names, go to WooCommerce → WooCommerce Multilingual & Multicurrency. In the Attributes tab, scroll down to the Translations of taxonomy labels and slug section and add the translations.

Best Regards,
Marcel

November 25, 2024 at 8:41 am #16438260

newcomS

Hi Marcel,

Yes I have read the documentation, but I would like to translate attribute names with a PHP script. Is there any way to achieve this, or is it only possible manually as described in the documentation?

Best Regards,
Dominik

November 26, 2024 at 6:39 am #16442661

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi Dominik,
I hope you're doing well.

I understand what you're looking for, but currently, it is not possible to translate the attribute name through the API. You can create the attribute by following hidden link">this guide, but the only way to translate the attribute name is by going to "WooCommerce → WooCommerce Multilingual & Multicurrency". Then, under the Attributes tab, scroll down to the "Translations of taxonomy labels and slugs" section and add the translations manually.

I know this may not be the solution you were hoping for, but at the moment, this is the only way to translate attribute names and slugs. However, we are aware of this limitation, and hopefully, future versions of WCML will include support for translating attribute labels and names.

I hope you can understand. Feel free to let me know if you have any other questions. I'll be happy to help.

Best regards,
Prosenjit