I have some issue with WPML. I use two different product page fro the phisical product and for the video lessons. Now I added one more language to the project ussin WPML plugin. And It's okay but my chunk of code I using for changed the template does not work. I use this code for changing template:
add_filter( 'template_include', 'bsl_single_product_template_include', 50, 1 );
function bsl_single_product_template_include( $template ) {
if ( is_singular('product') && (has_term( 'cosmetics', 'product_cat')) ) {
$template = get_stylesheet_directory() . '/woocommerce/single-product-cosmetics.php';
}
return $template;
}
How it should work: there is a product page and there is a video tutorial page. These pages have different templates. To change the template I use the code shown above. But after installing and configuring the second language when switching to the template does not occur. For example, I am on a physical product page, I switch the language and the page changes to the default one, although the product page should remain.