How could I hide element button in my case if the product is in specific category ?
I have tried
<div id="buttonid" if ( has_term( "category", "product_cat", $post->ID ) ) { echo 'style="display:none;"' }?>></div>
</div>
How could I hide element button in my case if the product is in specific category ?
I have tried
<div id="buttonid" if ( has_term( "category", "product_cat", $post->ID ) ) { echo 'style="display:none;"' }?>></div>
</div>
2
Answers
You can apply a condition on the button to not display in the specified category.If you want to do it by style
You missed php syntax: