WPML

問題の概要

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

回避策

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

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

すべての既知の問題

この問題についてサポートが必要な場合

サポートのご質問をお寄せください。一緒に調査いたします。