Home Woocommerce single product - template by categories
Reply: 0

Woocommerce single product - template by categories

user1475
1#
user1475 Published in June 25, 2018, 3:58 am

Already posted question but not working for me, so I'm asking a little help guys... ;)

There is my single-product.php (woocommerce file line:28)

 <?php if ( is_product_category( 'customcateg' ) ) 
    {
       woocommerce_get_template_part( 'content', 'single-product-customcateg' ); }
else {      
       woocommerce_get_template_part( 'content', 'single-product' ); } 
  ?>

I have in my theme/woocommerce 3 files:

  • single-product.php
  • content-single-product.php
  • content-single-product-customcateg.php

The files contains different php codes (the customcateg has to be protected from visitors, and some roles; this part is already done...)

When i try to access a product who is in "customcateg", it shows me the normal "single-product" template....

I tried to put :

 <?php if ( is_product_category( 'customcateg' ) ) 
    {
       woocommerce_get_template_part( 'content', 'single-product-customcateg' ); }
else {      
       woocommerce_get_template_part( 'content', 'single-product-customcateg' ); } 
  ?>

It simply show the single-product, but it has to show the customcateg one, but it does not. It only does when I pust the "single-product-customcateg.php" content in the "single-product.php" ...

What's wrong guys ?

Please help me :)

Thanks a lot by advance,

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.335102 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO