I need 2 different single product details templates to be activated by product category in Woocommerce

bev
5 Posts
bev posted this 02 April 2016

I have one category of products which require a completely different page layout in the product details page to the rest. I have managed to create a second Product Detail template in Themler but now need to get Woocommerce to recognise when to apply the alternative template.

In the single-product.php file, I thought to add an if else statement it would find the new template but cannot seem to get it to work.

 if(is_product_category('CATEGORY NAME') ) {

theme_load_template('Product Overview', 'product-details-2');}
else
{theme_load_template('Product Overview', 'productOverview');}

?>

Would really appreciate if anyone can spot what I am doing incorrectly or who have a better solution?

Many thanks
Bev

I have one category of products which require a completely different page layout in the product details page to the rest. I have managed to create a second Product Detail template in Themler but now need to get Woocommerce to recognise when to apply the alternative template. In the single-product.php file, I thought to add an if else statement it would find the new template but cannot seem to get it to work. if(is_product_category('CATEGORY NAME') ) { theme_load_template('Product Overview', 'product-details-2');} else {theme_load_template('Product Overview', 'productOverview');} ?> Would really appreciate if anyone can spot what I am doing incorrectly or who have a better solution? Many thanks Bev

Last edited 02 April 2016 by bev

Vote to pay developers attention to this features or issue.
1 Comments
Order By: Standard | Newest
Support Team
Support Team posted this 07 April 2016

Hello Bev,
I'd recommend that you follow this article
http://answers.themler.com/articles/9466/how-to-create-and-use-custom-templates
which explains how to work with custom templates.
If you get additional questions please let us know

regards,
Aileen

Hello Bev, I'd recommend that you follow this article http://answers.themler.com/articles/9466/how-to-create-and-use-custom-templates which explains how to work with custom templates. If you get additional questions please let us know regards, Aileen
You must log in or register to leave comments