Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

For example i have category coffee machines, and one template for coffee machine single product template, but for category coffee i want to have different single-product.php template, how to implement this? i haven't access to this post http://www.woothemes.com/support-forum/?viewtopic=83667 but it have similar question, with pages and categories in WordPress it simple, but how to do it in woocommerce?

share|improve this question

2 Answers

Make the new template and name it: taxonomy-product_cat-Your_category_product_slug.php as simple as this

share|improve this answer

You could change your single-product.php to just be a redirect to the correct template depending on what product category the current product it.

To do so you'd copy single-product.php to your theme's woocommerce folder. Rename it to single-product-default.php or anything. Create another copy and call it single-product-coffee.php. You can make whatever changes you'd like to make to this one.

Then in your single-product.php you could add a simple conditional to redirect to the appropriate single-product-something.php

if( has_term( 'coffee-maker', 'product-cat' ) ) {
    $file = 'single-product-coffee.php';
} else {
    $file = 'single-product-default.php';
}

global $woocommerce;

load_template( $woocommerce->template_url . $file );
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.