- Stato
- Aperto
- Segnalato per
- WPML Multilingual & Multicurrency for WooCommerce 5.4.5
- Plugin/tema correlato
- Product Filters for WooCommerce
- Tag dell’argomento
- Compatibility, WCML
Panoramica del problema
Quando utilizzi il widget “Filtra i prodotti per attributo” di Product Filters for WooCommerce e imposti l’opzione di visualizzazione su “Menu a discesa”, l’etichetta dell’attributo non viene tradotta sul frontend (ad es., “Seleziona colore”).
Soluzione alternativa
Assicurati di avere un backup completo del sito prima di procedere.
- Aggiungi il seguente codice al file functions.php del tuo tema.
/** * 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' ] ); } } } );