I wish to have a number of completely different templates relying on product class. Template for various class on woocommerce product I form of acquired it working
I’ve copied single-product.php
into theme-folder/woocommerce/
and have up to date the code to be
<?php the_post(); ?>
<?php
//wc_get_template_part( 'content material', 'single-product' );
if( has_term( 'course', 'product_cat' ) ) {
wc_get_template_part( 'content material', 'single-product-course' );
} else {
wc_get_template_part( 'content material', 'single-product' );
}
?>
<?php endwhile; // finish of the loop. ?>
Then I’ve created two information in theme-folder/woocommerce/
– content-single-product.php
and content-single-product-course.php
Each appear to show high quality when viewing the person merchandise, nonetheless, viewing the product with the course
the template shows an error, (though it does nonetheless render the HTML)
Warning: embrace(/website/wp-content/plugins/woocommerce-bookings/templates/booking-form/.php): did not open stream: No such file or listing in /website/wp-content/plugins/woocommerce/contains/wc-core-functions.php on line 345
# Time Reminiscence Operate Location
1 0.0009 413744 {predominant}( ) .../index.php:0
2 0.0010 415328 require( '/website/wp-blog-header.php' ) .../index.php:17
3 1.8879 63328264 require_once( '/website/wp-includes/template-loader.php' ) .../wp-blog-header.php:19
4 1.9015 63307352 embrace( '/website/wp-content/themes/dyfi-storefront-child/woocommerce/single-product.php' ) .../template-loader.php:106
5 1.9950 64097248 wc_get_template_part( ) .../single-product.php:44
6 1.9952 64098072 load_template( ) .../wc-core-functions.php:284
7 1.9954 64101152 require( '/website/wp-content/themes/dyfi-storefront-child/woocommerce/content-single-product-course.php' ) .../template.php:772
8 1.9970 64113712 do_action( ) .../content-single-product-course.php:62
9 1.9970 64114088 WP_Hook->do_action( ) .../plugin.php:470
10 1.9970 64114088 WP_Hook->apply_filters( ) .../class-wp-hook.php:327
11 2.0539 64450192 woocommerce_template_single_add_to_cart( ) .../class-wp-hook.php:303
12 2.0539 64450248 do_action( ) .../wc-template-functions.php:1667
13 2.0540 64450624 WP_Hook->do_action( ) .../plugin.php:470
14 2.0540 64450624 WP_Hook->apply_filters( ) .../class-wp-hook.php:327
15 2.0540 64451752 WC_Booking_Cart_Manager->add_to_cart( ) .../class-wp-hook.php:303
16 2.0554 64565880 wc_get_template( ) .../class-wc-booking-cart-manager.php:63
17 2.0558 64573392 embrace( '/website/wp-content/plugins/woocommerce-bookings/templates/single-product/add-to-cart/reserving.php' ) .../wc-core-functions.php:345
18 2.0559 64573432 WC_Booking_Form->output( ) .../reserving.php:41
19 2.0993 64632408 wc_get_template( ) .../class-wc-booking-form.php:400