最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Custom WooCommerce template for product

programmeradmin3浏览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?

发布评论

评论列表(0)

  1. 暂无评论