-
AuthorPosts
-
November 27, 2014 at 9:34 am #154049
Hi there,
It’s been a few days I’m stuck with this and I’m not sure what’s happening. I know WooCommerce is a bit out of the scope of your support but hopefully you can shed some light on this mystery… I’m trying to override the single product page template for a specific product category. I’ve read that you normally just have to copy the file “content-single-product.php” to your child theme template folder (/x-child-renew/woocommerce/) and rename it adding the category slug which you are trying to override.
The result is something like this “/x-child-renew/woocommerce/content-single-product-services.php”
Then, you also have to copy the file “single-product.php” and add the category conditional in it on line 28 :
<?php if (is_product_category( 'services' ) { woocommerce_get_template_part( 'content', 'single-product-services' ); }else{ woocommerce_get_template_part( 'content', 'single-product' ); } ?>
However, the new template is always ignored and nothing changes, I thought X maybe had a particular way of handling this page, but searching on the forums it seems not, so I’m not really sure where to start with this.
The only modification I’ve made in the new template is that I got rid of the featured image and gallery output.
Thank you!
Regards,
BastienNovember 27, 2014 at 10:35 am #154081It seems that the file “single-product.php” is completely ignored in the child theme. If I rename “content-single-product-services.php” to “content-single-product.php”, the right template display (but on every products). However “single-product.php” has no effect at all, I added various echos, changed the location of the file to every possible logical folder where it could sit, but nothing changes.
November 28, 2014 at 6:08 am #154410Hi Bastien,
Thanks for writing in!
You can try adding it in this directory wp-content /themes / child-theme /woocommerce /templates /
November 28, 2014 at 9:11 am #154499Hi,
I tried that but it didn’t work. It even says at the beginning of the file where to put it :
* Override this template by copying it to yourtheme/woocommerce/single-product.php
Anyway, I ended up coding a custom function in functions.php using WC hooks to remove the content I didn’t need and I think that’s a better solution.
Thank you!
November 29, 2014 at 2:20 am #154895Glad you solved the issue.
May 20, 2015 at 4:16 am #277588Hi,
I’ve exactly the same issue and it doesn’t look like it has been resolved since this thread.
single-product.php is still ignored and I don’t know how to resolve that.
Thanks
May 20, 2015 at 5:24 am #277622Hey there,
We’d love to help you with this however, this requires custom development. Regretfully, that falls outside the scope of our support. Bastien has solved the issue using Woocommerce Hooks. Please see Woocommerce documentation on how to utilize them. This requires technical knowledge of Woocommerce development. With that said, if you’re not comfortable with coding, I recommend you seek assistance from a WordPress developer to build your custom requirement for you.
Thank you for understanding.
-
AuthorPosts