Vai al contenuto Vai alla barra laterale

Open

Reported for: WooCommerce Multilingual & Multicurrency 5.4.5

Topic Tags: Compatibility, WCML

Overview of the issue

When using the “Filter products by attribute” widget from Product Filters for WooCommerce and setting the display option to “Dropdown”, the attribute label is not translated on the frontend (e.g., “Select Color”).

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Add the following code to your theme’s functions.php file.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    /**
     * Force the translation of product attribute labels on the frontend.
     *
     */
    add_action( 'after_setup_theme', function() {
        if ( ! is_admin() && ! wpml_is_ajax() && function_exists( 'WPMLContainermake' ) ) {
            $wcStrings = WPMLContainermake( WCML_WC_Strings::class );
     
            if ( $wcStrings ) {
                add_filter( 'woocommerce_attribute_taxonomies', [ $wcStrings, 'translate_attribute_taxonomies_labels' ] );
            }
        }
    } );

Lascia una risposta

Per favore rimani in tema e sii rispettoso verso gli altri. Se hai bisogno di aiuto per problemi non relativi a questo post, usa il nostro Forum di Supporto per iniziare una chat o inviare un ticket.

Puoi usare questi tag:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>