WPML

ภาพรวมของปัญหา

เมื่อใช้วิดเจ็ต ”Filter products by attribute” จาก Product Filters for WooCommerce และตั้งค่าตัวเลือกการแสดงผลเป็น “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' ] );
            }
        }
    } );

ปัญหาที่ทราบแล้วทั้งหมด

ต้องการความช่วยเหลือเกี่ยวกับปัญหานี้หรือไม่

ถามคำถามถึงฝ่ายสนับสนุน และเราจะตรวจสอบเรื่องนี้ไปพร้อมกับคุณ