Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I'm building a Shopify store using the Storefront API.
I noticed that in the most recent version of the API (2023-01) there is now support to filter products in a collection by tag. I need to filter by tag so I can show ladies or mens products, so this feature is very useful for me.
However it doesn't seem to be working.
When I run this query:
query { collection(handle: "greg-norman") { title products(first: 30, filters: { tag: "Mens" }) { nodes { title vendor tags } } } }
I get back this data:
{ "data": { "collection": { "title": "Greg Norman", "products": { "nodes": [ { "title": "Greg Norman Polo Umbrella Coral Guava", "vendor": "Greg Norman", "tags": ["G2S22K469", "Ladies", "Polo"] } // omitted for brevity ] } } } }
As you can see, the first product returned, doesn't actually match the tag that I'm filtering by. Any idea if I'm doing something wrong here?
Solved! Go to the solution
This is an accepted solution.
I found a solution:
https://github.com/Shopify/hydrogen/discussions/490
TLDR: you need to install the "Search and Discovery" app, and enable searching by tags from there.
I saw that they added it too but it seems work on the newer version 2023-04 but my problem is how to query more than one tag? I tried to use AND or to separate them with commas and that didn't work.
Did you ever get a response to this? I'm looking to filter tags with the OR method.
This is an accepted solution.
I found a solution:
https://github.com/Shopify/hydrogen/discussions/490
TLDR: you need to install the "Search and Discovery" app, and enable searching by tags from there.