Home›Support›English Support›[Waiting for user feedback] Translating WooCommerce product attributes via API
[Waiting for user feedback] Translating WooCommerce product attributes via API
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.
WordPress 6.7 has introduced a new issue that impact translations, please update WooCommerce and WPML to the latest versions before you report issues. More about this here - https://wpml.org/errata/php-error-wp-6-7-notice-function-_load_textdomain_just_in_time-was-called/
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?
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.
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.
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?
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.