Skip Navigation

[Résolu] condition with product tag

This support ticket is created Il y a 7 années. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 réponses, has 2 voix.

Last updated by SilviaC4418 Il y a 7 années.

Assisted by: Luo Yang.

Auteur
Publications
#506463

Hi,

I would like to set a condition with the product tag (woocommerce), but i can't figure it out how to set it.

If fact i want to know if the tag is emty or not, and if it's not empty then display the text between the shortcodes

 [wpv-conditional if="( empty([wpv-post-taxonomy type="tag"])"] display this if the tag is not empty[/wpv-conditional] 
#506624

Dear Silvia,

The taxonomy slug of product tag is "product_tag", please try to modify your shortcodes as below:
[wpv-conditional if="'[wpv-post-taxonomy type="product_tag"]' = ''"] display this if the tag is not empty[/wpv-conditional]

And test again

#506793

Hi,

I put your code but the text display even if the product_tag is empty

hidden link

#507153

Please try below codes:

[wpv-conditional if="( '[wpv-post-taxonomy type="product_tag" format="name"]' != '' )"]display this if the tag is not empty[/wpv-conditional]

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-conditional
Comparison operators: < or lt, > or gt, = or eq, <= or lte, >= or gte, != or ne

I have tested it in my localhost, if the problem still exists, please provide a test site with same problem,

#507168

It works fine with your new code!

Thanks a lot!!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.