Hi I am trying to show a section of content on a content template if the current product is in a certain category.
So, if Product X is in Product Category 'Voiceovers' then show Y HTML.
So far I have tried both of these but I think I am going rather wrong, any help would be appreciated 🙂
[wpv-conditional if="( has_term('voiceovers', 'post_category', null) = true )"]
HTML HERE
[/wpv-conditional]
[wpv-if evaluate="has_term('voiceovers', 'category', null) = true"]
HTML HERE
[/wpv-if]
Thank you for contacting Toolset Support. I am happy to help you with this. I am currently working on this ticket and will respond shortly with feedback.
Thanks, looking forward to your response 🙂
S
Just letting you know I am still testing a few things on my end and should be responding shortly with feedback.
There are a couple things to update:
1. Use product_cat instead of post_category
2. Go to Toolset > Settings > Front-end Content and make sure has_term is added to "Functions inside conditional evaluations" (see screenshot).
The code below should work:
[wpv-conditional if="( has_term('voiceovers', 'product_cat', null) eq '1' )" evaluate="true"]
HTML HERE
[/wpv-conditional]
Please let me know if this resolves the issue or if it needs more investigation.