What are the limits for creation of PriceRules and DiscountCodes?

Guest
Shopify Partner
7 0 0

I am developing an App and in my use-case I need to create a lot of DiscountCodes per PriceRule (could be above 10,000 per PriceRule) . Is there a limit for creating DiscountCodes ? The Api for getting all DiscoutCodes of a PriceRule does not return a paginated list, does it imply that there is a limit?

 

Also I need to create a lot of PriceRules ? Is there any limitations here?

 

thanks!

Replies 5 (5)
Renars
Shopify Partner
222 25 276

I have tasted creating DiscountCodes per single PriceRule, 100000+ Codes went in ok. Have not tested limits on the number of PriceRules.

 

image-1-768x600

Matrixify | Bulk Import Export Update | https://apps.shopify.com/excel-export-import | https://matrixify.app
Guest
Shopify Partner
7 0 0

Thanks for the input!

Did you try to retrieve them with GET /admin/price_rules/#{price_rule_id}/discount_codes.json call?

Cause it looks like it would be a problem to get a response with that much DiscountCodes...

 

thanks!

Zameer
Shopify Staff
Shopify Staff
297 31 88

There is currently a limit of 20M price rules and 20M discount codes per shop.

 

You would definitely be able to retrieve all discount codes using the endpoint which you mentioned.

 

However, there is a 250 limit on the number of resources returned for a single request, so you would have to break your request up until you retrieved all the discount codes.

 

This could be done most efficiently using the `since_id` parameter. Your initial call to the endpoint would be of the form: 

GET /admin/price_rules/#{price_rule_id}/discount_codes.json?since_id=0&limit=250

You would then take the largest id returned to you in that response, and use it as the `since_id` value for your next request. Continuing this process would allow you to retrieve all the discount codes associated with that price rule.

 

 

 

Guest
Shopify Partner
7 0 0

Thanks for the answer! it helps a lot. 

The only thing I want to point out is that I haven't seen it in the documentation, I think it could help to know the limitations and more important to understand how you make paginated calls from the documentation

Zameer
Shopify Staff
Shopify Staff
297 31 88

We're definitely in the process of coming up with a comprehensive guide to efficient pagination with `since_id`!

 

It will be announced on the forms when ready, so keep an eye out.