Webhook/API requests for PriceRules/Discounts

Shopify Partner
101 0 44

Request 1: ability to lookup PriceRule/Discount via discount code

To find the PriceRule that matches a given discount code (string) the API (https://help.shopify.com/api/reference/pricerule#show) requires a developer to:

- Get all PriceRules (per group of 250)

- Get each PriceRule and either inspect the Title (assuming it is the same as the DiscountCode) or get the DiscountCodes associated with it (https://help.shopify.com/api/reference/discountcode#show) to see the details and check if the code matches

For merchants that have large quantities of PriceRules the above system is very impractical. It is easy to hit the throttling limits. 

It would therefore be interesting to have an endpoint that allows lookup of a PriceRule (or potentially a list of PriceRules?) based on the discount code.

Request 2: webhooks

Also, in the development of our apps, we found the following webhooks would be very useful: PriceRule/create PriceRule/update and PriceRule/delete. Unfortunatley the documentation does not list any webhooks related to Price Rules or Discounts (https://help.shopify.com/api/reference/webhook).

Why? To allow us to keep a cache of discount codes/price rules in sync.

Why do you need a cache? Because calls to the PriceRules / Discount API are too expensive for some scenarios and because the amount of calls required can exceed the throttling limit.

Without webhooks we need to resort to polling the PriceRules API for changes. This means our cache is always out of date (and also may contain codes that actually do not exist anymore).

Am I missing something? Looking forward to hear about your perspective on this.

Bart Coppens | Limoni Apps | Building apps for Shopify since 2016
Replies 4 (4)
Shopify Partner
156 0 40

Following... thanks.

Shopify expert, software developer and designer.
11 0 6

(y) Agreed!

8 0 1

So it's 2021! Any update on this? I still don't see price rules or discount webhooks in the REST Admin API docs.

New Member
1 0 0

2022 any update on this, any chance?