ok, i found the issue, the tag is being converted into capital letters . from luxury > Luxury . is this normal ?
if i were to use many conditional code for tags will it affect the performance of the site, loading etc ?
The number of conditional blocks that you'll have with "has_term" function, will result in more processing time. To optimize this, you can use the "get_the_tags" function ( ref: https://developer.wordpress.org/reference/functions/get_the_tags/ ) to get all attached tag terms in a custom shortcode at once and then generate the markup/HTML accordingly.
1. If your requirement is to check whether an individual tag term is attached or not, then you'll continue on using your current approach of using the "has_term" function in a conditional block.
I suggested using tag term's slug instead of a name because slug is in all small letters and empty spaces are replaced by "-".
( example screenshot: hidden link )
For example, your code:
This is [wpv-conditional if="( has_term('tags 2', 'product-tag', null) eq '1' )" ]tag 2[/wpv-conditional]
Will become:
This is [wpv-conditional if="( has_term('tags-2', 'product-tag', null) eq '1' )" ]tag 2[/wpv-conditional]
Since the slug of your tag with name "tags 2" or "Tags 2" will most likely be "tags-2".
2. On the other hand, if your goal is to show all the attached tag terms to a post, you can show them all at once, without having to add a conditional check for each term.
To show the terms from product tags taxonomy in your view, you'll be able to use the shortcode inside your view's loop like this:
[show_attached_tags tax="product-tag"]
Note: I've used "get_the_terms" function in the example instead of the "get_the_tags", because the "get_the_tags" only works with the post tags taxonomy.
Thanks for clarifying that and yes, for a consolidated statement involving multiple tags, your current approach (of using multiple conditional blocks) is the way to go.
You're welcome to close this ticket and open a new one for a different issue/question.