Admin API products query is_price_reduced does not work

Highlighted
New Member
1 0 0

Hi,

I'm attempting to send the following Admin GraphQL query (to api/2020-10/graphql.json):

 

{
    products(first: 1, query:"is_price_reduced:true") { 
    edges{
      cursor
      node
      {
        id
        title
        variants(first:10)
        {
          edges
          {
            node
            {
              id
              compareAtPrice
              price
            }
          }
        }
      }
    }
  }
}

 

However this is returning:

 

{
    "data": {
        "products": {
            "edges": [
                {
                    "cursor": "eyJsYXN0X2lkIjo1MjA1MzEyMDEyMzMzLCJsYXN0X3ZhbHVlIjoiNTIwNTMxMjAxMjMzMyJ9",
                    "node": {
                        "id": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzUyMDUzMTIwMTIzMzM=",
                        "title": "Product that is not on offer",
                        "variants": {
                            "edges": [
                                {
                                    "node": {
                                        "id": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8zNDg3MzYxNTM4NDYyMQ==",
                                        "compareAtPrice": null,
                                        "price": "80.00"
                                    }
                                },
                                {
                                    "node": {
                                        "id": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8zNDg3MzYxNTQxNzM4OQ==",
                                        "compareAtPrice": null,
                                        "price": "80.00"
                                    }
                                },
                                {
                                    "node": {
                                        "id": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8zNDg3MzYxNTQ1MDE1Nw==",
                                        "compareAtPrice": null,
                                        "price": "80.00"
                                    }
                                },
                                {
                                    "node": {
                                        "id": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8zNDg3MzYxNTQ4MjkyNQ==",
                                        "compareAtPrice": null,
                                        "price": "80.00"
                                    }
                                },
                                {
                                    "node": {
                                        "id": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8zNDg3MzYxNTUxNTY5Mw==",
                                        "compareAtPrice": null,
                                        "price": "80.00"
                                    }
                                },
                                {
                                    "node": {
                                        "id": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8zNDg3MzYxNTU0ODQ2MQ==",
                                        "compareAtPrice": null,
                                        "price": "80.00"
                                    }
                                }
                            ]
                        }
                    }
                }
            ]
        }
    }
}

 

 

 

 

 

 

 

As you can see - none of the variations on this products are reduced price and they have null compare at prices.

Please advise on how to query for products using is_price_reduced, as documented in the documentation here:

https://shopify.dev/docs/admin-api/graphql/reference/queryroot#products-2020-10

Thanks,

Greg

 

0 Likes
Highlighted
Shopify Partner
1866 181 748

Hi @gregp 

Seems to be a distributed index issue. Add your compareAtPrice then hit the query a few times - you may see some return nothing for the specific product, sometimes return something until after a while each re-run of the query returns the products with compareAtPrice. Same when you null it again.

However, beware: I believe they still haven't fixed the issue mentioned here where compareAtPrice isn't actually checked to be greater than price i.e. defeating the meaning of is_price_reduced.

 

Hope that helps

Liked this post? You might also like our fantastic upsell apps Candy Rack and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
0 Likes
Highlighted
Shopify Staff
Shopify Staff
518 100 97

@KarlOffenberger enforced now! https://shopify.dev/concepts/about-apis/versioning/release-notes/2020-04

 
 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


Highlighted
Shopify Partner
1866 181 748

Awesome @vix . Must have slipped under my radar. Thanks for info!

Liked this post? You might also like our fantastic upsell apps Candy Rack and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
0 Likes
Highlighted
Tourist
4 0 0

Hi @vix and @KarlOffenberger thanks for your answers, both very helpful but I'm not sure that I'm understanding what the solution is here.

As you can see, in the original query the compareAtPrice of the variants are all null - in the UI they are not filled in. This is how we specify our products that are not on sale - can you confirm that this is the correct way to do it?

With regard to adding/removing compareAtPrices, I've tried various combinations of null or having the compareAtPrice==price and nothing seems to affect it - is_price_reduced doesn't seem to do anything to change the query results on version 2020-10 of the API (I've also tried with other versions of the API).

Is it essentially just broken and doesn't do anything or is there some way to get it to work?

(Posted by gregp - accidentally logged into my colleagues account)

0 Likes