Add Custom CSS to Woocommerce Product Page in a specified category
Here’s my solution… Added the following to functions.php in my child theme: add_filter( ‘body_class’,’my_body_classes2′ ); function my_body_classes2( $classes ) { if ( is_product() ) { global $post; $terms = get_the_terms( $post->ID, ‘product_cat’ ); foreach ($terms as $term) { $product_cat_id = $term->term_id; $classes[] = ‘product-in-cat-‘ . $product_cat_id; } } return $classes; } Now whenever you’re viewing … Read more