Focusing on managing products, variants, and collections through the API.
the is_price_reduced query does not work on products, even though the documentation says it should (using 2024-10 api version).
example query:
{ products(first:10 query:"is_price_reduced:on") { edges { node { id hasOutOfStockVariants variants(first: 10) { edges { node { price compareAtPrice sku } } } } } } }
results:
{ "data": { "products": { "edges": [ { "node": { "id": "gid://shopify/Product/5481981149343", "hasOutOfStockVariants": false, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "40071" } } ] } } }, { "node": { "id": "gid://shopify/Product/5481981214879", "hasOutOfStockVariants": true, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "40109" } } ] } } }, { "node": { "id": "gid://shopify/Product/5481981345951", "hasOutOfStockVariants": true, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "40980" } } ] } } }, { "node": { "id": "gid://shopify/Product/5481981411487", "hasOutOfStockVariants": true, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "40981" } } ] } } }, { "node": { "id": "gid://shopify/Product/5481981509791", "hasOutOfStockVariants": true, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "41005" } } ] } } }, { "node": { "id": "gid://shopify/Product/5481981804703", "hasOutOfStockVariants": true, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "41007" } } ] } } }, { "node": { "id": "gid://shopify/Product/5481981870239", "hasOutOfStockVariants": true, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "41014" } } ] } } }, { "node": { "id": "gid://shopify/Product/5481981968543", "hasOutOfStockVariants": true, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "41016" } } ] } } }, { "node": { "id": "gid://shopify/Product/5481982034079", "hasOutOfStockVariants": false, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "41018" } } ] } } }, { "node": { "id": "gid://shopify/Product/5481982132383", "hasOutOfStockVariants": true, "variants": { "edges": [ { "node": { "price": "4.89", "compareAtPrice": "4.89", "sku": "41020" } } ] } } } ] } }, "extensions": { "cost": { "requestedQueryCost": 30, "actualQueryCost": 18, "throttleStatus": { "maximumAvailable": 2000, "currentlyAvailable": 1982, "restoreRate": 100 } }, "search": [ { "path": [ "products" ], "query": "is_price_reduced:on", "parsed": { "field": "is_price_reduced", "match_all": "on" } } ] } }
As you can see the filter is parsed correctly from the query, but I am getting all results back. you can see the price and compareAtPrice fields are the same.
Is there a fix for this?
Hi @mattyonice
According to the API documentation, is_price_reduced is of type boolean, so it makes more sense to use true
Thanks for the reply. I'm saying that the filter doesn't work if you use "true" or "false", or any valid boolean identifier.
The query is not respected even though the field is being captured by the graphql operation.
Also, the boolean field in a query can accept, "on", "off", "true", "false", "t", "n", 1 or 0. You can see this if you try to put another field in the query.
I.e.
query:"is_price_reduced:invalid"
Results in this:
Please try it yourself.