WPML
ステータス
未解決
報告対象
WPML Multilingual & Multicurrency for WooCommerce 5.4.5
関連するプラグイン/テーマ
Product Filters for WooCommerce
トピックタグ
Compatibility, WCML

問題の概要

Product Filters for WooCommerceの「Filter products by attribute」ウィジェットを使用し、表示オプションを「Dropdown」に設定すると、フロントエンドで属性ラベル(例: 「Select Color」)が翻訳されません。

回避策

続行する前に、サイトの完全なバックアップを取得していることを確認してください。


  • テーマのfunctions.phpファイルに以下のコードを追加します。
    /**
     * 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' ] );
            }
        }
    } );
            

すべての既知の問題 →