My Discount Stops Working When There Are Many Items In The Cart!
Are you noticing your discount stop working when a certain number of items are in the cart? Or are you seeing your discount only apply in the cart/checkout sometimes?
The problem you're facing is because Shopify Functions, where our app runs code on Shopify's servers, has strict limits on how much it can handle at once. This is why your discounts aren't applying correctly when the cart gets full.
Workarounds
You could try setting up more discounts, where each one has fewer conditions. This way, each discount remains simpler and is less likely to hit Shopify's limits.
For example, if you have a discount that checks for 5 different collections, you could try creating 3 discounts, where each only checks for 1-2 collections.
Shopify lets you set up to 25 different automatic discounts.
If this doesn't work, there's another trick you might try, which you can find here:
Regios Tech Workaround for App-Based Discounts Limit.
FAQs
When am I likely to have this issue?
This issue can occur when you have a logic flow that is complex. Having about 5 to 8 "Check If" steps is an indicator of a complex logic and such logic hits the limit quickly.
Or, you may be checking for multiple collections in a discount, especially if the number is 4, 5, or higher.
Do I make my discounts have a single condition?
It doesn't necessarily have to be just 1 condition per discount. But the more conditions, the more likely you will hit the limit.
What should I expect if I contact Shopify support about this?
Shopify support will likely send a generic response, and it may point to the app as the cause. Shopify can't diagnose why a Discount Function isn't working on a specific cart without running profiling tools, and merchants reaching Shopify support are very unlikely to get that level of investigation.
We recommend not taking Shopify's diagnosis as fact up front. Instead, contact us with the store and an example cart, and wait for our team to complete a full investigation.
Technical information
The Shopify Functions API places a limit of 11 million WebAssembly instructions executed when running a Function on any cart with fewer than 200 line items. After 200, the limit scales proportionally. However, the vast majority of orders are below 200 line items, and they all share the same constraints.
For further details, we recommend checking Shopify's documentation on the Functions API:
What factors contribute to hitting the limit?
Overall, the bigger the input data, and the more complex your logic, the faster you will hit this limit. However, the size of the input data has a far bigger impact than the actual complexity of the logic.
- Customer/product tags/collections: The more tags/collections you query, the bigger the input data, and it grows linearly with each one. For example, if your discount checks for 5 separate tags, then the input data includes 5 additional JSON objects, one for each of those tags. This adds up quickly.
- Cart size: More cart lines -> bigger input data -> more instructions
- Complex logic: More conditions/branches -> more work to do per cart line -> more instructions
Shopify provides data about the cart to our app's discount in a format called JSON. This is a text-based format, so in order for computers to understand, they must perform a process called parsing. Even when using the fastest possible parsing algorithms, the number of instructions executed scales at least linearly to the size of the input data.
What measures have you taken to work around this limit?
Our app's discount logic is highly optimized to execute as few instructions as possible. Between September and November 2026, we shipped a series of improvements aimed at large carts. On real carts that used to fail, the work dropped a lot: for example, a free-gift discount on a cart with 95 different line items went from about 33 million instructions to about 7 million, well under Shopify's 11 million limit.
Shopify's limit itself hasn't changed, and JSON parsing still takes work for every cart line, so very large carts with complex logic can still hit it. If yours did in the past, test it again on the Test discounts page or send us the discount and we'll check it.
Common misconceptions
- This is not a limit we have set ourselves. It was completely set on Shopify's end.
- Discounts are not applied as items are added to the cart. Instead, the entire cart is sent by Shopify to our app's discount as input for discount calculations. This means that the discount logic evaluates the entire cart at once, which can lead to hitting the instruction limit on larger input data.
- There’s no difference in how Shopify handles instruction limits for discount codes and automatic discounts. Both are subject to the same constraints.
- The quantity of each item has a negligible impact on performance; it's about the number of cart lines. For example, 1 x Product A and 50 x Product A would have roughly the same impact. But if Product A has 50 variants, and you have 1 of each in the cart, that's 50 cart lines, which means way bigger input data.
I would like this limit to increase
This is not a limit we have set ourselves. It was completely set on Shopify's end, as mentioned elsewhere in this article. If you would like to provide feedback about this limit to Shopify, please comment on this GitHub discussion:
https://github.com/Shopify/function-examples/discussions/329
Your Feedback Matters
Your review helps keep this small business running. Please leave one on the Shopify App Store.
Updated on: 03/11/2026
Thank you!