Stack Discounts on Top of Sale Price And Product Discounts Option
The "Stack discounts on top of sale price and product discounts" setting has restrictions due to technical limitations within Shopify itself:
- It only supports calculating one group of discounts
- It only supports percentage discounts, not fixed amount/price
- Separate groups of percentage discounts cannot be combined into one.
- The Maximum Quantity Input is not supported when using this setting.
This is because the feature itself is a workaround that relies on an undocumented behavior of Shopify's Discount Function API.
Therefore, this setting is only suitable for order discounts with simple product eligibility criteria.
Examples of supported logic:
- 20% off the entire order
- 10% off specific products
- 5% off all items in a specific collection, except for a few excluded products
Examples of unsupported logic when using the "Stack discounts on top of sale price and product discounts" setting:
- 10% off Collection A, 20% off Collection B
Technical Limitations of the Discount Function API
- Unlike product discounts (which can apply different discounts to different products), order discount Functions can only produce one discount on the entire order subtotal.
- Order discounts cannot see what the prices of cart lines are after product discounts have applied. This is because Shopify triggers both product and order Discount Functions in parallel. This means they are calculated at the same time, independent of each other.
The Workaround
Through experimentation, we noticed that the behavior of order Discount Functions changes based the type of discount the Function calculates:
- If it's a fixed amount, Shopify will apply that exact amount to the order subtotal directly.
- However, if it's a percentage discount, Shopify will calculate that amount based on the order subtotal after product discounts.
Therefore, we can take advantage of this behavior in certain narrow cases.
Examples of Why These Restrictions Are Necessary
Since order discounts can only calculate one discount, and it's impossible to know what product discounts have been applied, there are certain situations where the app could potentially produce the wrong discount. Complex calculations with percentage discounts (such as summing them with other discounts) require us to know what price we are taking a percentage of. In many cases, this is simply possible due to not having visibility into product discount application:
- If Product A has a 20% discount, and Product B has a 10% discount
- If Product A has a $10 discount, and Product B has a 10% discount
- If a 10% discount is applied to 3 x Product A and 2 x Product B
In all of these cases, we can't sum these together because we don't know the final prices of Product A or B (since either could have product discounts applied).
Other cases:
- If Product A has a $10 fixed amount discount, we can't convert that into a percentage order discount without knowing what the price of Product A after product discounts is (which is impossible).
Therefore, we prevent this from happening through strict restrictions.
Why the Maximum Quantity Input Can't Be Used With This Setting
You might have noticed that there is technically one case where it would be feasible to support maximum quantities with percentage:
- If only one line item receives a percentage discount, and the discount has a maximum quantity, we can divide the percentage by the ratio of the discounted quantity to the cart line's entire quantity. For example, if a cart line has a quantity of 5, and it receives a 20% discount with a quantity of 4, we can multiply 20 by (4/5) and get 16%.
However, this is a narrow edge case. In all the other cases, there would be a ton of confusion, so we have completely disabled the "Maximum quantity" input when using this setting.
Updated on: 17/10/2025
Thank you!