Skip Navigation

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

Problem:
The client is trying to translate product attribute labels in WPML and encounters issues in both String translation and Taxonomy translation. The taxonomy general name is not plural and includes an untranslated English 'Product' prefix, which cannot be corrected through the UI.
Solution:
To remove the 'Product' prefix from the taxonomy general name and manually add the plural form of the taxonomy singular name, we recommend using a custom filter hook in WooCommerce. Here is the code you can use:

add_filter( 'woocommerce_product_attribute_taxonomy_name', 'custom_woocommerce_attribute_label_plural', 10, 2 );
 
function custom_woocommerce_attribute_label_plural( $taxonomy_name, $taxonomy ) {
    if ( 'pa_your_attribute' === $taxonomy ) { // Replace 'pa_your_attribute' with the actual attribute taxonomy name
        // Return the custom label you want
        return 'Label'; // Replace with your desired label
    }
    return $taxonomy_name;
}

This code will change the appearance of the label on the frontend but not in the wp-admin. Alternatively, you could register the original taxonomy in English and translate it into German.

If this solution does not resolve your issue or seems outdated, please check the related known issues, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. If needed, do not hesitate to 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 1 reply, has 0 voices.

Last updated by Andreas W. 2 weeks ago.

Assisted by: Andreas W..

Author Posts
January 23, 2025 at 11:21 am #16627419

frederikB-5

Background of the issue:
I am trying to translate product attribute labels in WPML. I see issue in both String translation and Taxonomy translation. The problem is visible in String translation: hidden link and in Taxonomy translation: hidden link

Symptoms:
The taxonomy general name is not a plural and includes an untranslated English 'Product' prefix. This cannot be corrected through the UI. Attempts to delete the taxonomy general name result in it being regenerated when using Taxonomy translation.

Questions:
How can I remove the 'Product' prefix from the taxonomy general name?
Is there a way to manually add the plural form of the taxonomy singular name without the automatic generation?

January 25, 2025 at 9:33 pm #16633961

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

This is WooCommerce default behavior.

To overwrite this label you can use the following hook:

add_filter( 'woocommerce_product_attribute_taxonomy_name', 'custom_woocommerce_attribute_label_plural', 10, 2 );

function custom_woocommerce_attribute_label_plural( $taxonomy_name, $taxonomy ) {
    if ( 'pa_your_attribute' === $taxonomy ) { // Replace 'pa_your_attribute' with the actual attribute taxonomy name
        // Return the custom label you want
        return 'Label'; // Replace with your desired label
    }
    return $taxonomy_name;
}

This filter hook will only change the appearance of the label on Frontend, not on wp-admin.

The alternative would be registering the original taxonomy in English and translating it into German.

Best regards
Andreas