How to find Shopify orders sold below cost after discounts
For Shopify merchants who run discount codes · 5-minute read
Discount codes are easy to create and hard to audit. A code that looks fine on one product can push another below what it cost you, especially when it stacks with a sale price or applies to the whole order. This guide shows how to find those order lines, first by hand and then the quick way.
Why Shopify's reports don't show this
Shopify's profit reports show gross profit by product, and the discount reports show how often each code was used. Neither tells you which individual order lines sold for less than your cost per item once every discount was applied. A product can be profitable overall while some of its orders lost money.
Step 1: Add cost per item to your products
Everything depends on Shopify knowing your cost. In Shopify admin, open a product, then each variant, and fill in Cost per item. Shopify only uses the cost recorded at the time of the sale, so add it before running promotions if you can.
Step 2: Export your orders and products
- Orders: Orders → Export → choose the date range → CSV for Excel, Numbers, or other spreadsheet programs.
- Products: Products → Export → CSV. Check the file has a
Cost per itemcolumn.
Step 3: Work out what each line really sold for
The Orders export has one row per line item. For each row, the amount the customer actually paid for that line is:
Lineitem price × Lineitem quantity − Lineitem discount − the line's share of order-wide discounts
Order-wide codes (for example 15% off everything) aren't on the line rows. A fair way to split them is in proportion to each line's price. Skip free-shipping codes, which don't reduce what the product sold for, and skip refunded or voided orders.
Step 4: Compare with cost
Look up each line's Cost per item by SKU from the Products export, multiply by quantity, and compare:
| Line | Paid after discounts | Cost × qty | Result |
|---|---|---|---|
| Hoodie, 35% code | $26.00 | $31.00 | −$5.00 |
| Mug ×2, 10% order code | $32.40 | $22.00 | +$10.40 |
Any negative result was sold below cost. Sort by the biggest losses and look at which codes and products show up most.
The one-minute version. Lossline does steps 3 and 4 for you: drop in the two exports and it lists every line sold below cost, worst first, with the total. It runs in your browser, so your files are never uploaded, and it's free.
What to do with the results
- Exclude thin-margin products from broad codes instead of ending the promotion.
- Cap percentage codes below each product's margin, or switch to fixed-amount codes with a minimum order value.
- Stop stacking codes on products that are already on sale.
- Check public codes: codes posted on coupon sites get used far more than planned.
- Fill in missing costs. Lines without a cost can't be checked at all.