WPML
Status
Offen
Gemeldet für
WPML Multilingual & Multicurrency for WooCommerce 5.4.5
Zugehöriges Plugin/Theme
Product Filters for WooCommerce
Themen-Tags
Compatibility, WCML

Übersicht über das Problem

Wenn Sie das Widget „Filter products by attribute“ von Product Filters for WooCommerce verwenden und die Anzeigeoption auf „Dropdown“ setzen, wird die Attribut-Beschriftung im Frontend nicht übersetzt (z. B. „Select Color“).

Problemumgehung

Bitte stellen Sie sicher, dass Sie über ein vollständiges Backup Ihrer Website verfügen, bevor Sie fortfahren.


  • Fügen Sie den folgenden Code in die Datei functions.php Ihres Themes ein.
    /**
     * 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' ] );
            }
        }
    } );
            

Alle bekannten Probleme →