Filter collection with SPECIFIC tags

Solved
Highlighted
New Member
4 0 0

Howdy,

I have a collection that I need to filter using tags. I have everything working as I followed these instructions:

https://help.shopify.com/themes/customization/collections/filter-collections-with-product-tags

and using the Radio Button instructions on that page.

HOWEVER, I only want it to display a few tags,  like 'CIVIC' and 'Mixed-Use' and a few more, rather then a massive list of tags.

Can someone show me how I can do that?

 

Thanks!

0 Likes
Highlighted
Shopify Expert
2684 67 841

This is an accepted solution.

Hi Ric,

one option is to have a pre-defined list of tags and only show tags from the current collection which are on this list.

The tutorial has this code

  {% for tag in collection.all_tags %}

You can change it like this:

{% assign show_tags = "Civic,Mixed Use,Other,More" | split: "," %}

{% for tag in collection.all_tags %}
  {% unless show_tags contains tag %}
     {% continue %}
  {% endunless %}

Note that comparison is case-sensitive here. 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
2 Likes
Highlighted
New Member
4 0 0

Thank you, Tim!

That works perfectly!

0 Likes
Highlighted
Shopify Partner
26 0 2

Is there a way using the tutorial for tags to create the radio buttons by filtering/sorting product type?

I have found some other forum discussions but seems complicated to organize.
We simply want to have Collections -  example: Wedding > with radio buttons - necklaces, earrings, etc 
Gifts for Him > key chains, tie clips etc
Thanks!
 

0 Likes
Highlighted
Shopify Partner
26 0 2

Further details are the store is https://www.ekalake.com/
using an out of support free Shopify theme -  New Standard

Collections are not yet setup as client is wanting to change to - so rather than necklaces, she wants Wedding as example for the Collection. Then would like the radio buttons to sort/filter by Product Type.

I can do this with specific tags it seems with the code by @tim - is this the easiest and best way to do this?

Thanks

 

 

0 Likes
Highlighted

I have issue in one of my shopify project. when i added a tag filter in collection pages rest of the filters are not working can you help me?

https://snekersstart.myshopify.com/collections/yeezy
Password:- neihea

if you click in any model tag filter then the rest of the tags are not working and if we can't click in model tag filter then rest of tags are properly working

0 Likes
Highlighted
New Member
2 0 0

HI! I am using this method of filtering on my site! It works really well! Thank you! I have tried to research myself but can't figure out the sort order. Instead of alphabetical I'd like my list to go by the order I list them in. Is there a way to do that? Thanks for this code!

0 Likes
Highlighted
Tourist
4 0 0

Hi

is it possible to filter and show only if the variants are in stock?

0 Likes