WPML
Trạng thái
Đang mở
Được báo cáo cho
WPML Multilingual & Multicurrency for WooCommerce 5.4.5
Plugin/giao diện liên quan
Product Filters for WooCommerce
Thẻ chủ đề
Compatibility, WCML

Tổng quan về lỗi

Khi sử dụng widget “Filter products by attribute” từ Product Filters for WooCommerce và thiết lập tùy chọn hiển thị thành “Dropdown”, nhãn thuộc tính không được dịch trên frontend (ví dụ: “Select Color”).

Giải pháp tạm thời

Vui lòng đảm bảo bạn có bản sao lưu toàn bộ trang web trước khi tiếp tục.


  • Thêm mã sau vào tệp functions.php của giao diện.
    /**
     * 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' ] );
            }
        }
    } );
            

Tất cả các lỗi đã ghi nhận →