'Hide Content on Product Page depending on taxonomy (brand) - WooCommerce
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 );
Solution 1:[1]
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>';
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mujuonly |
