Filter collection with SPECIFIC tags

Solved
Ric_Berryman
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
tim
Shopify Expert
2937 141 985

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!
Ric_Berryman
New Member
4 0 0

Thank you, Tim!

That works perfectly!

0 Likes
Darleen_Witmer2
Shopify Partner
30 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
Darleen_Witmer2
Shopify Partner
30 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

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
Weezie
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
mendyschwartz
Tourist
4 0 0

Hi

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

0 Likes
collinsmbaka
Excursionist
27 1 7

Yes, you might want to check out this app Ultimate Product Filter + Search
It will allow your customers to filter by stock status and so much more.

Collins Mbaka | Support Specialist @ Ultimate Search and Filter

- Was my reply helpful? Click Like to let me know!
- Want to see how Ultimate Search and Filter can help grow your sales? Click here to try it out for free.
0 Likes
brumisrl
New Member
4 0 0

Hello Tim,

 

how to re-order the tags as my choice and not alphabetically?
Of course these are price options and I want that the order is: "<150,<500,<1000,>1000"

 

Schermata 2021-03-08 alle 14.40.27.png

 

 

Thanks

 

Davide

 

 

0 Likes