Home WooCommerce custom single page
Reply: 0

WooCommerce custom single page

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

I am trying to build out a custom view for single product pages within WooCommerce. If a product say lives in a category called 'custom' I want WooCommerce to detect this by switching to a custom page layout if the product lives in that category.

I have tried to do this by adding the following code to single-product.php

    if (is_product_category( 'custom')) {
        wc_get_template_part( 'content', 'single-product-custom' );
    } else {
        wc_get_template_part( 'content', 'single-product' );
    }   

I have created a category called 'custom' and also created a template called 'conent-single-product-custom.php'but I get an error if I place an item in the custom category which is the following:

Warning: include(/home/website/public_html/wp-content/themes/theme/woocommerce/single-product-custom.php): failed to open stream: No such file or directory in /home/website/public_html/wp-includes/template-loader.php on line 89

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO