Override content-single-product doesnt work
-
I have a problem, and im struggling two days with it. So, I have web with woocommerce that is still on localhost. I have problem with template override. I overrided loop start, end, content-product.php and content-single-product.php in my theme and that works ok. I have problem with content-single-product.php because I want it to make dependable on category (whatever as identification – id, name, slug). So I found few solutions on google but none will work. In my singe-product.php I replaced
wc_get_template_part( 'content', 'single-product' );
with
if ( is_product_category( 'my-cat-slug' ) ) { wc_get_template_part( 'content', 'single-product-dogs' ); } else { wc_get_template_part( 'content', 'single-product' ); }
I tried putting instead of my-cat-slug actual Cat Name, I tried using !is_product_category to get inverse… Also nothing. Of course I put single-product.php to woocommerce folder in my theme where rest of working overridden files are. And I created file content-single-product-dogs.php where I copied content from content-single-product.php with some changes, as small as just TEST written somewehere.
Am i doing something wrong or? Since even if i change
wc_get_template_part( 'content', 'single-product' );
to
wc_get_template_part( 'content', 'single-product-dogs' );
in original woocommerce plugin templates folder… i have no effect. It always falls back to content-single-product.php and changes i do there…
I have no more ideas. Please someone help ??
P.S Is it possible to change default product-image.php that will be different for that custom content-single-product-dog.php?
Thanks
- The topic ‘Override content-single-product doesnt work’ is closed to new replies.