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.