Bỏ qua điều hướng

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.
    /**
     * Force the translation of product attribute labels on the frontend.
     *
     * @see https://onthegosystems.myjetbrains.com/youtrack/issue/wcml-5066
     */
    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' ] );
            }
        }
    } );
            

Để lại phản hồi

Vui lòng bám sát chủ đề và tôn trọng người khác. Nếu bạn cần trợ giúp với các vấn đề không liên quan đến bài đăng này, hãy sử dụng Diễn đàn Hỗ trợ của chúng tôi để bắt đầu trò chuyện hoặc gửi yêu cầu hỗ trợ.

Bạn có thể sử dụng các thẻ sau:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>