1/**
2 * Get custom single product page template for a category
3 */
4
5function my_custom_product_template($template, $slug, $name) {
6 if ($name === 'single-product' && $slug === 'content') {
7 global $product_cat;
8 $temp = locate_template(array("{$slug}-{$name}-{$product_cat}.php", WC()->template_path() . "{$slug}-{$name}-{$product_cat}.php"));
9 if($temp) {
10 $template = $temp;
11 }
12 }
13 return $template;
14}
15
16add_filter('wc_get_template_part', 'my_custom_product_template', 10, 3);