Home WooCommerce custom theme by category
Reply: 0

WooCommerce custom theme by category

user1381
1#
user1381 Published in June 25, 2018, 3:55 am

I'm trying to create specific Woo templates for product categories in WooCommerce.

I've tried to follow the instructions here but they didn't work for me. Woocommerce single product - template by categories

I also found this but couldn't get it to work. http://wordpress.org/support/topic/plugin-woocommerce-excelling-ecommerce-a-custom-single-product-template

In my theme I have a woocommerce folder with the specific template files that I want to override.

theme/woocommerce/single-product.php
theme/woocommerce/content-single-product.php
theme/woocommerce/content-single-product-custom-1.php

here is part of single-product.php

<?php if (is_product_category( 'custom-1')) {
    wc_get_template_part( 'content', 'single-product-custom-1' );
    }
    elseif (is_product_category( 'promise') {
    wc_get_template_part( 'content', 'single-product-custom-2' );
    }
    else{
    wc_get_template_part( 'content', 'single-product' );
    } 
?>

I have the custom-1 category setup in woo on the specific product I want to target.

When I edit content-single-product-custom-1.php nothing changes. However when I make changes to content-single-product.php they are show up.

Why am I not able to target the my product categories?

Thanks in advance!

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO