Skip Navigation

Resolved

Reported for: WooCommerce Multilingual & Multicurrency 5.2.0

Resolved in: WCML 5.3.0

Topic Tags: Compatibility

Overview of the issue

In situations where you have created a Divi template to be displayed for All Archive pages, and you also have a taxonomy-product_cat.php file in your theme, a conflict will appear. Specifically, your Divi template will only be displayed in the default language. Whenever you switch languages, it will display the template from the taxonomy-product_cat.php file instead of the Divi template.

Workaround

Please, make sure of having a full backup of your site before proceeding.

  • Open your theme’s functions.php file.
  • Add the following code:
    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);
    

Note

This issue may appear as well with Elementor templates. In that case, you will need to use this snippet instead:

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);