Creating Separate Templates for Products Leads to Error

I need to create a variety of templates for different categories. I have this code posted in ‘single-product.php’ to change template’s based upon a category name:

if( has_term( 'drip-emitters', 'product_cat' ) ) {
    $file = 'single-product-wide.php';
} else {
    $file = 'single-product.php';

global $woocommerce;

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

But I experience the following error message:

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 have ‘single-product-wide.php’ uploaded, so I’m not sure how to fix the error.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.