Only display certain tags within the filter section on collection pages.

Only display certain tags within the filter section on collection pages.

BoulevardNorth
Shopify Partner
1 0 0

I have a clothing store and would like to give customers the option to filter collection pages by "Colour". I have multiple tags within product pages that I do not want shown. When I go into the Filter section of Shopify and create a new filter called "Colour" and source it from the "Tags" option, every single tag I have appears on the Collection Page. How can I make sure only the colour tags are showing and not all the other tags I have setup that I'm using to organize in the backend?

 

Thanks in advance!

Reply 1 (1)

Guleria
Shopify Partner
4150 809 1164

Hello @BoulevardNorth ,

 

Check the theme settings for the option to exclude the tags which you don't want.  
If that option is not available in the theme you are using you need to find the existing code and modify it so the tags you don't want will not appears .
e.g. 
lets say my existing code is:

{% for tag in collection.all_tags %}
  <a href="{{ collection.url }}?filter={{ tag }}">{{ tag }}</a>
{% endfor %}

and I want to modify it to exclude tags "tag1,tag2,tag3" then after modification my code will be

{% assign allowed_tags = "tag1,tag2,tag3" | split: ',' %}

{% for tag in collection.all_tags %}
  {% if allowed_tags contains tag %}
    <a href="{{ collection.url }}?filter={{ tag }}">{{ tag }}</a>
  {% endif %}
{% endfor %}

 

Thanks



 

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder