Inventory

Stockout Cost: Calculate What a Sold-Out Shopify Product Really Costs

What a stockout cost actually includes

Stockout cost is the profit and future demand you lose because a product is unavailable when a customer wants to buy it. For a Shopify store, the core number is lost units times contribution margin, then adjusted for substitutes, backorders, and demand you cannot observe.

A sold-out listing is not free just because Shopify stops taking the order. You still paid to acquire the traffic, you still hold the rest of the catalog, and some of those shoppers will not come back for that SKU.

Count the margin you failed to earn, not the full retail price, and do not treat an estimate as a cash figure you can invoice.

What belongs in the cost:

  • Lost contribution margin on units you would have sold during the gap.
  • Extra acquisition cost if you have to win the same buyer back later.
  • Lost repeat orders when the stockout hits a replenishment item.
  • Expedite fees, split shipments, or refunds if you accept backorders and miss the promise.
  • The opportunity cost of ad spend that kept sending people to an unavailable product.

What does not belong:

  • The full sticker price. Cost of goods was never incurred on the missed unit, so using revenue inflates the loss.
  • Inventory you still own. That is a carrying-cost problem, not a stockout.
  • A made-up lifetime value multiplier with no cohort data behind it.
  • Every visit to the product page. Many of those sessions would not have converted even if the item was in stock.

IHL Group's 2023 study, "Retailers and the Ghost Economy: The Haunting of Returns," estimated that worldwide retail losses from out-of-stocks were $1.2 trillion. The same research, covered by the National Retail Federation, found that shoppers facing an out-of-stock often leave empty-handed, switch stores, or substitute rather than wait. That industry figure is a scale check, not your store's number. Your number has to come from one SKU, one gap, and a margin you can defend. See what a stock-out means if you need the operational definition before the math.

How to estimate lost sales and margin for one sold-out SKU

Use the sales rate from the period just before the product went unavailable, multiply by the days it was out, then apply contribution margin. That is the base stockout cost. Everything else is an adjustment you should label as an assumption.

The formula:

  1. Baseline daily units = units sold in a clean in-stock window divided by days in that window.
  2. Expected units = baseline daily units times days unavailable.
  3. Contribution margin per unit = selling price minus cost of goods, payment fees, and the variable fulfillment cost you would have paid to ship that unit.
  4. Unrecovered units = expected units minus units that were only delayed (preorders that still ship) and minus substitute units you can tie to the gap.
  5. Substitute margin gap = substitute units times (sold-out SKU margin minus substitute SKU margin). If the substitute earns less, those units are not a full save.
  6. Base stockout cost = (unrecovered units times sold-out contribution margin) plus the substitute margin gap.
  7. Add only the extra costs you can point to: wasted ad spend on that product, expedite fees, and a repeat-purchase loss if you have the order history. Wasted ad spend belongs on this cost line. It does not belong in reorder payback, because a purchase order does not recover or eliminate it.

Pull the inputs from places you already have. Shopify Analytics and the product's order history give units and revenue. Your cost of goods should come from the inventory item cost you maintain, not from a guessed markup. Payment fees come from your Shopify Payments or processor rate. Shipping cost per order comes from recent fulfilled orders for that SKU, not from the carrier's published rate card.

Pick the baseline window carefully. A practical heuristic is 7 to 28 in-stock days for a steady seller, not a sourced benchmark. Drop promo days, a one-off influencer spike, and any day the variant was already unavailable. If the product is seasonal, compare the same weekday mix, not a random month from last quarter.

Shopify can show you when inventory hit zero if you track inventory for that variant, but it cannot tell you how many people would have bought. Treat the sales-rate method as an estimate of unobserved demand. If the product page conversion rate was already falling before the stockout, do not freeze the old rate and call it lost demand.

A worked Shopify example, with the assumptions stated

Take a $48 moisturizer that sells about 4 units a day when it is in stock. It is unavailable for 11 days. Cost of goods is $14, payment fees are about 3% of the price, and pick-pack-ship averages $6. The store kept running a $30 daily ad set pointed at that product for 6 of those days. Nine buyers switched to another SKU in the same line that earns $11 of contribution margin, so each switch still loses $15.56.

InputFigureWhy it is in the math
In-stock sales rate4 units/dayLast 21 in-stock days, promo days removed
Days unavailable11Variant inventory at zero, continue selling off
Price$48Current variant price
Variable cost$21.44$14 COGS + $1.44 fees + $6 fulfillment
Contribution margin$26.56Price minus variable cost
Expected units444 × 11
Substitute units9Lift on the other SKU during the gap
Substitute margin$11What those 9 units actually earned
Margin still lost per switch$15.56$26.56 minus $11
Unrecovered units3544 minus 9, valued at full margin
Margin on unrecovered units$929.6035 × $26.56
Margin gap on substitutes$140.049 × $15.56
Base stockout cost$1,069.64$929.60 plus $140.04
Wasted product ads$180$30/day × 6 days. Avoidable waste, not reorder payback
Working total$1,249.64Stockout cost plus ads you can tie to the SKU. Do not use this total for payback

The $1,069.64 is the margin a restock is trying to protect. The $180 is ad waste you stop by pausing the campaign. A reorder does not recover that spend or eliminate it, so keep it out of payback. Using $1,249.64 as if the purchase order earned the ads back would overstate how fast the cash returns. The full $1,249.64 is a working estimate of the gap, not a loss on the profit and loss statement, and not the denominator for a purchase order.

Subtracting all 9 substitute units and then valuing only the remaining 35 at $26.56 would understate the margin loss by $140.04, because those switched units still earn $15.56 less than the sold-out SKU. Two other assumptions do most of the remaining work: demand would have stayed at 4 units a day, and the 9 substitute units are true lift, not sales that SKU would have made anyway. If either is wrong, the cost moves with it.

A sensitivity check keeps the number honest. Hold the same 9 substitutes and the same $15.56 margin gap ($140.04). At 3 units a day, expected units are 33, unrecovered units are 24, and base stockout cost is 24 × $26.56 plus $140.04, or $777.48. At 5 units a day, expected units are 55, unrecovered units are 46, and base stockout cost is 46 × $26.56 plus $140.04, or $1,361.80. Report the range if you are using the figure to justify a purchase order. Leave the $180 ad line out of every case in that range.

Do not add a customer lifetime value on top unless you can see the reorder rate for this product. A one-time gift SKU and a 60-day replenishment SKU do not deserve the same multiplier. If 20% of buyers of this moisturizer reorder within 90 days and you have that in your own orders, then a fraction of the 35 unrecovered units may also cost you a second order. Say so as a separate line, with the reorder rate attached. Do not apply that multiplier to the 9 substitute buyers, because they already placed an order.

Delayed orders, substitutes, and demand you cannot see

Three behaviors change the math, and each one is measurable if you decide what to count before you open the spreadsheet.

Backorders and delayed orders

If you keep selling while inventory is zero, some of the expected units are only delayed. Do not count a preorder as a lost sale. Count the extra cost of fulfilling it late: expedited inbound freight, a discount you offered for the wait, refunds, and support time if you track it.

A practical split: units that eventually ship inside your normal promise window are delayed, not lost. Units that cancel before fulfillment are lost, and you already have the cancellation in Shopify. Units that never get ordered because the page said sold out stay in the estimate, because you will never see them as orders.

Substitutes

A substitute only reduces stockout cost if the customer bought something else from you that they would not have bought otherwise. Compare the substitute SKU's daily sales during the gap with its own prior in-stock baseline. The lift above that baseline is the recovered demand. Sales that were already happening do not offset the stockout.

Margin matters here too. If the substitute earns $11 and the sold-out SKU earns $26.56, each switched unit still costs you $15.56. Count recovered units at the margin difference, not as a full save. In the example above, that is 9 × $15.56 = $140.04 added back onto the margin lost on the 35 unrecovered units.

Uncertain demand

The sales-rate method fails when the stockout itself changed traffic. A bestseller that disappears from a collection, a paid campaign, or Google's free listings will show a lower session count, so no orders understates the miss. A product you pushed harder after it sold out will show more sessions, so page views overstate it.

Use a band instead of one number when any of these are true:

  • The SKU sells fewer than roughly 15 units a month. This is a practical cutoff, not a published benchmark: a few orders swing the daily rate.
  • The gap overlaps a sale, a product launch, or a season change.
  • You cannot separate this variant from a bundled or multi-variant product.
  • Most demand arrives from one campaign you paused mid-gap.

In those cases, report low, base, and high lost units, and restock decisions should survive the low case. If the purchase order only pays off in the high case, you are buying a story, not covering a cost.

Which products to restock first when cash is limited

Rank by margin dollars a restock can earn back per day, not by units sold, not by ad spend still pointed at the SKU, and not by how loud the sold-out badge feels. A $12 accessory moving 20 units a day can matter less than a $26-margin hero moving 4.

Payback and stock coverage answer different questions. Do not collapse them into one ratio, and do not fold ad spend into either one.

Payback, in days, estimates how long the projected daily margin would take to recover the purchase cost. It does not tell you how many days of stockout the purchase order prevents. Reordering recovers margin on units you can sell again. It does not recover or eliminate ad spend already pointed at an unavailable SKU.

  1. Daily margin at risk = baseline daily units times contribution margin, minus substitute margin you reliably recover. Leave ad spend out of this line.
  2. Payback days = reorder cost (what you pay the supplier for the purchase order) divided by daily margin at risk. Adding ad spend to that daily margin shortens payback and overstates the case for the PO.
  3. A shorter payback means the cash comes back faster at the projected margin rate, if that rate holds. It is not days of cover.

Avoidable ad waste is a separate action, not a payback input. Daily spend still pointed at the unavailable variant stops when you pause or redirect it, whether or not you reorder. Track that waste on the stockout cost, then keep it off the payback line.

Stock coverage is a separate check. Days of stockout you can actually avoid depend on order quantity, units already on hand, supplier lead time, and demand during the gap, not on the payback ratio.

  1. Days of cover from the PO = order quantity divided by baseline daily units.
  2. Days of stockout avoided = the overlap between that cover and the window you would otherwise be at zero, after you subtract current stock and the units you will sell during lead time.
  3. If lead time is longer than the remaining selling window, extra units do not prevent a stockout you have already missed. They can become overstock instead.

Cash limits the list, so apply three filters before you send the PO:

  • Skip SKUs whose low-case daily margin at risk, with ad spend excluded, does not recover the purchase cost inside a payback window you can live with, and whose order quantity does not cover the lead-time gap.
  • Prefer items with a reorder history. A first-time viral SKU can sell out once and never repeat.
  • Check lead time against the gap you are already in. If the supplier needs 21 days and you only have 11 days of estimated demand left in the season, a full reorder can create the opposite problem: overstock.

Set the alert before the zero, not after. If lead time is 14 days and you sell 4 units a day, you need a warning around 56 units plus a buffer for demand spikes, not a notification the morning inventory hits zero. Shopify inventory alerts cover how to time that warning. For a full walk-through of what one missed reorder did to revenue, the stockout case study is the companion to this calculation.

If you want the reorder point, the days of cover, and the sold-out risk in one place instead of rebuilding this sheet every Monday, Skymetrics' stock intelligence watches inventory against sales pace and flags the SKUs whose next stockout would cost the most margin. The calculation above is still yours to audit. A forecast does not replace the contribution margin, the substitute check, or the low-case test.

What to do with the number this week

Pick the sold-out or nearly sold-out SKU with the highest daily margin a restock can earn back. Compute expected units from a clean in-stock window, value unrecovered units at full contribution margin, and add the margin gap on substitute lift you can see. Pause ads on variants you cannot ship, and keep that saved spend out of payback. Then separate payback (reorder cost divided by daily margin at risk, with ad spend excluded) from coverage (order quantity, on-hand stock, lead time, and demand), and place the reorder that clears both. Ignore the rest until cash allows it.