- สถานะ
- เปิด
- รายงานสำหรับ
- WPML Multilingual & Multicurrency for WooCommerce 5.4.5
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- Product Filters for WooCommerce
- แท็กหัวข้อ
- Compatibility, WCML
ภาพรวมของปัญหา
เมื่อใช้วิดเจ็ต ”Filter products by attribute” จาก Product Filters for WooCommerce และตั้งค่าตัวเลือกการแสดงผลเป็น “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' ] ); } } } );