Creating Custom Single Product Page layout based on Different Category

Creating Custom Single Product Page layout based on Different Category
/*Custom Template Include*/
add_filter( 'template_include', 'victoria_template_include' );
function victoria_template_include( $template ) {
  /*Victorial Theatre Single Movie*/
  if ( is_singular('product') && (has_term( 'vic-theatre', 'product_cat')) ) {
    $template = get_stylesheet_directory() . '/woocommerce/single-product-victoria-film-theatre.php';
  } 

  /*Victorial Film Fest Single Movie*/
  if ( is_singular('product') && (has_term( 'film-festival-movies', 'product_cat')) ) {
    $template = get_stylesheet_directory() . '/woocommerce/single-product-victoria-film-festival.php';
  } 

  return $template;
}

Leave a Reply

Your email address will not be published. Required fields are marked *