- Trạng thái
- Đã giải quyết
- Được báo cáo cho
- WPML Multilingual & Multicurrency for WooCommerce 5.2.0
- Đã giải quyết trong
- WCML 5.3.0
- Thẻ chủ đề
- Compatibility
Tổng quan về lỗi
Trong trường hợp bạn đã tạo một template Divi để hiển thị cho Tất cả các trang Lưu trữ, và bạn cũng có tệp taxonomy-product_cat.php trong giao diện của mình, một xung đột sẽ xảy ra. Cụ thể, template Divi của bạn sẽ chỉ được hiển thị bằng ngôn ngữ mặc định. Bất cứ khi nào bạn chuyển đổi ngôn ngữ, hệ thống sẽ hiển thị template từ tệp taxonomy-product_cat.php thay vì template Divi.
Giải pháp tạm thời
Vui lòng đảm bảo bạn đã tạo một bản sao lưu đầy đủ cho trang web trước khi tiếp tục.
- Mở tệp functions.php trong giao diện của bạn.
- Thêm đoạn mã sau:
add_filter('template_include', function ($template){ if (function_exists('wc_locate_template') && strpos($template, 'Divi/includes/builder') !== false && !file_exists(wc_locate_template(basename($template)))) { global $woocommerce_wpml; remove_filter( 'template_include', [ $woocommerce_wpml->store, 'template_loader' ], 100 ); } return $template; }, 99);
Lưu ý
Sự cố này cũng có thể xuất hiện với các mẫu Elementor. Trong trường hợp đó, bạn sẽ cần sử dụng đoạn mã này thay thế:
add_filter('template_include', function ($template){
if (function_exists('wc_locate_template') && strpos($template, 'elementor') !== false && !file_exists(wc_locate_template(basename($template)))) {
global $woocommerce_wpml;
remove_filter( 'template_include', [ $woocommerce_wpml->store, 'template_loader' ], 100 );
}
return $template;
}, 12);