Skip to content

Instantly share code, notes, and snippets.

@matthijs166
Created December 28, 2017 16:37
Show Gist options
  • Save matthijs166/17eae646db4270e198e2f68c445c4e2f to your computer and use it in GitHub Desktop.
Save matthijs166/17eae646db4270e198e2f68c445c4e2f to your computer and use it in GitHub Desktop.
Select custom template woocommerce
add_filter( 'template_include', 'so_25789472_template_include' );
function so_25789472_template_include( $template ) {
if ( is_singular('product') && (has_term( 'mock', 'product_cat')) ) {
$template = get_stylesheet_directory() . '/woocommerce/single-product-mock.php';
}
return $template;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment