Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
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!
I have tasted creating DiscountCodes per single PriceRule, 100000+ Codes went in ok. Have not tested limits on the number of PriceRules.
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!
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.
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
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.
User | RANK |
---|---|
4 | |
4 | |
4 | |
3 | |
3 |