Filtering products in a collection by tag #490
-
|
Sorry if this isn't the right place, but I figured I'm more likely to find a developer who can help me here 😅 {
collection(handle: "latest-stuff") {
products(first: 250, filters: {tag: "Tee"}) {
edges {
node {
tags
}
}
}
}
}The products returned don't seem to be filtered at all. {
"data": {
"collection": {
"products": {
"edges": [
{
"node": {
"tags": [
"0",
"2",
"4",
"6",
"Black",
"Blouse",
"DKNY",
"White"
]
}
},
{
"node": {
"tags": [
"0",
"2",
"4",
"6",
"Black",
"DKNY",
"Tee",
"White"
]
}
},
{
"node": {
"tags": [
"2",
"4",
"6",
"Black",
"DKNY",
"Dress"
]
}
},
{
"node": {
"tags": [
"0",
"2",
"Black",
"DKNY",
"Dress",
"White"
]
}
},
{
"node": {
"tags": [
"0",
"2",
"4",
"6",
"Black",
"DKNY",
"Heathered Dove",
"Tee",
"White"
]
}
},
{
"node": {
"tags": [
"0",
"2",
"6",
"Black",
"DKNY",
"Dress"
]
}
},
{
"node": {
"tags": [
"0",
"2",
"4",
"6",
"Black",
"DKNY",
"Dress",
"Red"
]
}
},
{
"node": {
"tags": [
"0",
"2",
"4",
"6",
"DKNY",
"Dress",
"Pulse"
]
}
},
{
"node": {
"tags": [
"0",
"2",
"4",
"DKNY",
"Heather Grey",
"Sweater",
"White"
]
}
}
]
}
}
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
|
Can you try adding the "Search and Discovery" app, and then adding "tags" as something that's enabled? I could be wrong but I think it has to be enabled that way for it to work correctly. Let me know if that doesn't do it. |
Beta Was this translation helpful? Give feedback.
-
|
When building with Remix or Hydrogen, getting the Storefront API syntax exactly right for filtering can be tricky, especially since the API evolved recently. A common issue is the formatting of the query parameter. When filtering by tag, the syntax usually requires a specific string format like query: "tag:your-tag-name". If you are trying to combine multiple tags, ensure you are using the correct boolean logic (AND/OR) within that string. Also, double-check that your API version in your shopify.server.ts or client config is set to at least 2023-01 or later, as older versions handle filtering differently. Beyond the Code: Improving User Experience For many Shopify developers, using a native approach like Misk Variant Options is a lifesaver. It is built as a Native App Embed, meaning it stays stable and loads instantly with your theme. This ensures that once your tags and filters work, the actual product selection feels smooth and Great and Beautiful for the shopper. It’s a simple way to make sure your custom build stays professional and flicker-free. |
Beta Was this translation helpful? Give feedback.






Can you try adding the "Search and Discovery" app, and then adding "tags" as something that's enabled? I could be wrong but I think it has to be enabled that way for it to work correctly. Let me know if that doesn't do it.