What's the URL structure for filtering all products with multiple tags?

Highlighted
Tourist
10 0 2

Hi,

 

I understand that to get all my products, the URL structure looks like that:

 

my-shopify.com/collections/all

 

Say I want to get all the products that are red, I tried this yesterday and it worked pretty well:

 

my-shopify.com/collections/all/red

 

But I'm struggling to find a solution that shows the products that are red or blue. I've tried:

 

my-shopify.com/collections/all/red+blue 

 

but it doesn't work.

 

What are the solutions? 

 

0 Likes
Tourist
25 2 4

The bad news is that for collections, this is not possible. The filtering collections by tags only works with AND operator, like red+blue which would look products in the collection that are tagged both red AND blue, which is not what you want.

 

The good news is that there are 2 tricks that might be good enough...

 

1) there is a kind of work around using search, like so:

/search?type=product&q=red+OR+blue

Be aware, this will search through all your store's products' titles, descriptions, tags, etc for either "red" or "blue" -- not just the tags, like the collection filtering method you were trying.

 

2) If that's not good enough, there is one more approach to try via the admin. Use this link:

https://shopify.com/admin/products?query=tag:red+OR+blue

This will pull up all the products in your store tagged either red or blue, then it's just a matter of selecting all the products in this filter, clicking Actions, then Add tags, then give all these products a new tag such as RedBlueGroup, then you could use this link:

my-shopify.com/collections/all/RedBlueGroup

 

Hope that helps

0 Likes
Tourist
10 0 2

Thanks a lot, I had never heard of those two techniques. The /search method seems the best fit for my case, it's kinda 'hacky', but whatever. Cheers

0 Likes
Tourist
10 0 2

Actually, it doesn't work. When I try to filter by a specific tag with spaces or special characters inside, like a ":", it doesn't work.

 

For example, I have this product in my inventory that has exactly this tag: Editor:Flammarion

 

Here's what I've tried and it doesn't work:

  • myshopify.com/search?type=product&q=editor-flammarion
  • myshopify.com/search?type=product&q=Editor:Flammarion
  • myshopify.com/search?type=product&q=Editor%3AFlammarion

But when I try those URLs, it doesn't even give me one result even thought I have multiple items with this exact tag... :/

 

On the other hand I can definitely go in my Shopify admin and filter my items by multiple tags (url in the Admin looks like myshopify.com/admin/products?tag=Editor%3AFlammarion) and it works!

0 Likes
Tourist
25 2 4

Interesting, I don't think I had never tried the search link method with a character like a colon, thanks for letting me know. Glad the other method works!

0 Likes