Hide a Tag That Contains Phrase

Highlighted
New Member
5 0 0

Hi, I am currently using the code below to hide specific exact match tags on my collection pages.  I am now trying to also hide any tag that "contains 'YGroup' (not exact match, just anything that contains that prefix".  I tried so many ideas from the forums but can't get it to work.  ANyone else try to do this with success?

{% for tag in collection.all_tags %}
{% if (tag != 'Recommendations disabled') and (tag != 'SEARCHANISE_IGNORE') and (tag != 'boostflow-hidden') and (tag != 'mw-fee') and (tag != 'pfs:hidden') and (tag != 'Hidden recommendation') and (tag != 'Deals') and (tag != 'NOSEARCH') and (tag != 'default-HIDE') and (tag != 'Endless Blossoms') and (tag != 'Queen of Gems') and (tag != 'spo-disabled') %}
{% if current_tags contains tag %}
<li class="active">
{{ tag | link_to_remove_tag: tag }}
</li>
{% else %}
<li>
{{ tag | link_to_tag: tag }}
</li>
{% endif %}
{% endif %}

{% endfor %}

0 Likes