Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Heya,
I'm trying to query for some collection products given a group of filters. For some reason, these queries get filtered as expected if only one filter is used, but as soon as I provide 2 or more filters as parameters, the results aren't excluded & return completely randomly.
I found some related threads that suggested to enable the Search & Discovery app, but even with it installed & configured, I can only filter with one input or another.
https://github.com/Shopify/hydrogen/discussions/490
Any clues? How can i filter for the products of a collection with 2 or more parameters? (i.e: with a tag "lorem" & a price below "200")
Hi @niko7o ,
Please use this query this might be helpful for you,
{
collectionByHandle(handle: "summer-collection") {
id
title
}
products(first: 10) {
nodes {
options {
id
values
}
}
}
productVariants(first: 10, query: "price:<50", sortKey: TITLE){
edges{
node{
price
title
id
metafields(first:5){
edges{
node{
id
namespace
key
}
}
}
}
}
}
}
Please let me know if you need any more suggestions.
Thanks....