0

I've created a specific product template for a few of my WooCommerce products. However not all of the plugins and WooCommerce JS files load on this page. I assume it's leaving out some default headers a WooCommerce product page would otherwise have.

function custom_single_product_template_include( $template ) {
  if ( is_singular('product') && (has_term( 'book-a-room', 'product_cat')) ) {
      $template = get_stylesheet_directory() . '/template-book-a-room.php';
  } 
  return $template;
}
add_filter( 'template_include', 'custom_single_product_template_include', 50, 1 );

Is there any way I can assign this page as a WooCommerce page so all the default files load?

2
  • "Woocommerce Single Product Page Customizer" use this plugin Mar 19 '20 at 7:16
  • Thanks for your comment, this is quite bespoke functionality that the plugin wouldn't allow me to do. I just need a second single.php file for products essentially. Default one and a bespoke one
    – SamXronn
    Mar 19 '20 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.