Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

is_price_reduced query on Products not working

is_price_reduced query on Products not working

mattyonice
Shopify Partner
5 0 4

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?

Replies 2 (2)

Kyle_liu
Shopify Partner
223 32 40

Hi @mattyonice 

 

According to the API documentation, is_price_reduced is of type boolean, so it makes more sense to use true

 

Kyle_liu_0-1728370968845.png

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me on ([email protected])
mattyonice
Shopify Partner
5 0 4

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:

mattyonice_0-1729086168030.png

Please try it yourself.