Skip Navigation

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 2 days, 3 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