Home Multiple WooCommerce Single Product Templates
Reply: 0

Multiple WooCommerce Single Product Templates

user5659
1#
user5659 Published in September 19, 2018, 6:44 pm

Following these instructions to have WooCommerce load a different 'single-product' template:

if( has_term( 'termgoeshere', 'product_cat' ) ) {
        $file = 'single-product-newtempforterm.php';
            } else {
                $file = 'single-product.php';
    }

    global $woocommerce;

    load_template( $woocommerce->template_url . $file );

I'm experiencing an error:

Warning: require_once(woocommerce/single-product-wide.php): failed to open stream: No such file or directory in /home/xxx/public_html/wp-includes/template.php on line 572

Fatal error: require_once(): Failed opening required 'woocommerce/single-product-wide.php' (include_path='.:/usr/local/php54/pear') in /home/xxx/public_html/wp-includes/template.php on line 572

I'm not sure where to begin to fix the problem.

share|improve this question
  • 1
    $woocommerce->template_url has deprecated since v 2.1 use wc_get_template_part() instead. – Khorshed Alam Nov 4 '16 at 6:38

1 Answer 1

active oldest votes
up vote 1 down vote
You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO