In short: Inside one OneCode discount, every item gets the single best product discount it qualifies for, only the order discount that saves the most is used, and each shipping discount applies to the rates it targets. Product, order and shipping discounts from the same code all apply together.
Step by step
When a customer's cart or checkout changes, OneCode: Stackable Discounts checks the discount in this order:
Global Conditions. Every global condition must be met. If even one isn't, nothing in this discount applies.
Each discount type on its own. OneCode checks each discount type's target, exclusions and Per-Discount Conditions separately. A discount type that doesn't qualify is simply skipped. The others still apply.
Pick the winners:
Product discounts: if two or more product discount types would discount the same item, the item gets the one that saves the most. They aren't added together.
Order discounts: if two or more order discount types qualify, only the one that saves the most is applied.
Shipping discounts: each shipping discount type applies to the shipping rates it targets.
Apply them together. The winning product, order and shipping discounts all apply at the same time.
Worked example: tiers don't add up
A discount has three product discount types on the same collection, each with a Cart Quantity condition (the number of items in the whole cart):
10% off when the cart has 2 or more items.
15% off when the cart has 3 or more items.
20% off when the cart has 4 or more items.
A customer adds 3 items. Both the 10% and the 15% qualify, so each item gets 15% off. It does not get 25%. With 4 items, each item gets 20%.
This "best one wins" rule is what makes tiered discounts easy to build. See Buy more, save more: quantity tiers.
Worked example: product plus order plus shipping
A code has 20% off the Summer Collection, $10 off the order and free shipping. A customer buys a $50 Summer Collection shirt and a $30 accessory:
The shirt gets 20% off: $10 saved.
The order gets $10 off. Shopify takes order discounts off the subtotal after product discounts, so it comes off the $70 left.
Shipping is free.
Good to know
Discounts in the same OneCode discount always work together. How they combine with other discounts in your store depends on the Combinations setting. See How OneCode discounts combine with your other discounts.
If two product discount types save exactly the same amount on an item, the one higher in the list is used.
Shipping is different between separate discounts: Shopify applies only one shipping discount per order. If a customer has two different shipping discounts, Shopify uses the one that saves the most.
For the customer's side of this, see Why did only one discount apply?.
