How do I hide a tag from my filters?

Solved
alx_noa
New Member
2 0 0

Hi! Our shop uses a third-party integration pulling products to their site. I have a specific tag I am supposed to use "no import", but I can't figure out how to keep this from showing in my filters on the collection page. Is there a prefix I can use to hide the tag? Or does anyone know where I would do this in the code file? 

 

I am using Prestige theme from Maestroo. 

 

tl;dr - How do I hide a tag from my filters?

0 Likes
PaulNewton
Shopify Partner
2583 136 471

This is an accepted solution.

The convention to hide tags is to prepend an underscore(_) to the tag names , so "_no import".

Of course not all themes have this built in, so you have to make your own filter snippet

Basically you want any forloop going over tags skip the loop if the tag is unwanted

 

filter-tags.liquid:

{%- assign tag_start = tag | slice: 0 -%}
{% if tag_start = "_" or tag contains "no import" %}
 {% continue %}
{% endif %}

This is a starting example, you may need to keep track of current number or tags meant to be visible(thus counting invisible too)

or completely {% break %} out of the current loop or parent loops if all the tags are unwanted

 

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
thunderstarter
New Member
2 0 0

Hi, I have the same issue. I'm trying to list items from a 3rd Party tool into Shopify and it uses tags to send this information.

 

I'm using the Venture Shopify theme and when I list an item, it is passing all the tags through and applying them as filters. In order to tell shopify to ignore all of these filters but to use the ones with an underscore in front of the name '_filtername' where do I apply the .liquid code shown above, as I don't have a .liquid file called 'filter-tags.liquid'

 

I have a file called 'collection-filters.liquid' Do I copy it into here? Is so where does it go?

 

Screenshot 2019-11-05 at 06.55.12.png

 

Thanks

Dan

0 Likes
thunderstarter
New Member
2 0 0

I have now added the above code as a snippet, but it is still not working. Am I doing something wrong here? Time to hire a shopify developer I think!

 

Screenshot 2019-11-05 at 07.08.42.png

0 Likes
PaulNewton
Shopify Partner
2583 136 471

Typo correction, if statements need TWO equal signs ==

{%- assign tag_start = tag | slice: 0 -%}
{% if tag_start == "_" or tag contains "no import" %}
 {% continue %}
{% endif %}

 

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
phil_CM
Excursionist
76 1 4

Am I missing something? Do you just crest the snippet and that’s all or do you have to include it somewhere??

0 Likes