Hello,
We are facing an issue with the Storefront GraphQL API filters and the Shopify Search & Discovery App. We built a custom theme filtering solution a while back for a merchant that uses a set of Storefront API access enabled metafield definitions. Those definitions have individual filter values grouped through the Shopify Search & Discover App so that we can create range filters for metafield values.
This approach has worked up until recently, and it appears it’s now only returning results matching exact values instead of by the groups’ value.
We use the following GQL query to fetch/filter products for a collection:
query getProducts($first: Int, $after: String, $handle: String, $filters: [ProductFilter!], $sortKey: ProductCollectionSortKeys, $reverse: Boolean) {
collection(handle: $handle) {
products(first: $first, after: $after, filters: $filters, sortKey: $sortKey, reverse: $reverse) {
edges {
cursor
node {
title
productType
availableForSale
onlineStoreUrl
handle
variants(first: 1) {
edges {
node {
priceV2 {
amount
}
compareAtPriceV2 {
amount
}
}
}
}
images(first: 4) {
edges {
node {
originalSrc
altText
}
}
}
metafield(namespace: "global", key: "[key]") {
namespace
key
value
}
}
}
pageInfo {
hasNextPage
}
}
}
}
Here’s an example query input:
{
"first": 250,
"after": null,
"filters": [
{
"productMetafield": {
"namespace": "global",
"key": "[key_0]",
"value": "[value]"
},
"productMetafield": {
"namespace": "global",
"key": "[key_0]",
"value": "[value]"
},
"productMetafield": {
"namespace": "global",
"key": "[key_1]",
"value": "[value]"
},
}
],
"handle": "all",
"sortKey": "MANUAL",
"reverse": false
}
We haven’t been able to find any related breaking changes in the Shopify Developer Changelog to indicate a change in API behavior, but we found a few similar posts here in the forums from earlier this month.
Let us know if you need any additional information. This issue is affecting a merchant’s live store and we would like to get it resolved as soon as possible.
Thanks!