Home > Mobile >  Hide Content on Product Page depending on taxonomy (brand) - WooCommerce
Hide Content on Product Page depending on taxonomy (brand) - WooCommerce

Time:04-30

I am trying to display content in woocommerce_single_product_summary except for products of certain brands.

I use the Perfect WooCommerce Brands plugin, so the key is $taxonomy = 'pwb-brand';

I am not able to complete the code with the brand exclusion:

function ad_product_banner() { 
echo '<p id="banner-product">Custom Text</p>';
};     
add_action( 'woocommerce_single_product_summary', 'ad_product_banner', 15 );

CodePudding user response:

add_action( 'woocommerce_single_product_summary', 'ad_product_banner', 20 );
 
function ad_product_banner() {
    if ( !has_term('brand-slug', 'product_brand' ) ) { // Except 
        echo '<p id="banner-product">Custom Text</p>';
    }
}
  • Related