WooCommerce - How to create multiple single product template based on category?
/* Diamond Category */
add_filter( 'template_include', 'so_25789472_template_include' );
function so_25789472_template_include( $template ) {
if ( is_singular('product') && (has_term( 'diamond', 'product_cat')) ) {
$template = get_stylesheet_directory() . '/woocommerce/single-product- diamond.php';
}
return $template;
}
Comments
Post a Comment