Answers for "How to check if the product is in a certain category on a single-product"

0

How to check if the product is in a certain category on a single-product

if ( has_term( 'audio', 'product_cat' ) ) {

       echo 'In audio';
       woocommerce_get_template_part( 'content', 'single-product' );

} elseif ( has_term( 'elektro', 'product_cat' ) ) {

       echo 'In elektro';
       woocommerce_get_template_part( 'content', 'single-product' );

} else {
       echo 'some blabla';
}
Posted by: Guest on October-06-2021

Code answers related to "How to check if the product is in a certain category on a single-product"

Browse Popular Code Answers by Language