URL Structure for searching products with tags containing spaces, colons etc.

Solved
Highlighted
Tourist
10 0 2

I'd like to be able to combine multiple filters together, and someone told me that one possible solution would be to use the "search" method. So I have been playing around with the URL of my shop to try and figure out how it works before I jump into the code.

 

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

 

Here are the URLs that I've tried and they all don'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
  • myshopify.com/search?tag=Editor%3AFlammarion

Trying those URLs doesn't even give me one result even though 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!

 

Can someone please tell what is the correct URL ?

 

Thanks!

0 Likes

Success.

Tourist
25 2 4

Hi, give this a try:

 

myshopify.com/search?type=product&q=Editor\:Flammarion

 

You need to use backslash escaping on the colon, per this documentation:
https://help.shopify.com/en/api/getting-started/search-syntax#special-characters

 

Hope that helps

1 Like
Tourist
10 0 2

Thank you so much!

1 Like