Every example and amount on this page is illustrative. It shows the method and is not a benchmark, a quote or advice.

What the metric actually measures

Stockout cost is the economic impact of inventory being unavailable when a customer might otherwise have bought it. It is not the same as the product’s selling price, and it is not automatically equal to the revenue shown in a sales forecast. The relevant question is how much profitable trading the stockout prevented, plus which secondary effects can reasonably be attributed to it.

The most defensible part is measurable lost contribution. Start with the demand that was probably missed, then value the profit remaining after the costs that would have changed with the sale. Depending on the purpose of the analysis, that may mean gross profit after product cost, or contribution after payment, fulfilment and advertising costs. The distinction matters: a $40 sale does not create $40 of stockout cost. Review what belongs in ecommerce COGS and how contribution margin is used in ecommerce KPIs.

Other effects belong in the analysis, but should be labelled separately rather than presented as proven loss.

A stockout can also redirect a customer to another product, delay the purchase until inventory returns, send the customer to a competitor, or reduce confidence in the store. A later order may be evidence of a delayed purchase, but it does not prove that every missed visit or future customer value came from the stockout. These effects are decision-relevant hypotheses, not automatically measurable stockout cost.

This separation prevents two common errors: counting all unavailable units as certain sales, and treating uncertain customer harm as precise financial loss. The metric is strongest when it reports a measurable contribution estimate and shows assumptions or possible effects alongside it. It can support decisions about the cost of preventing a stockout, but it cannot prove exactly how every customer would have behaved.

What belongs in a stockout cost estimate
ComponentHow to treat it
Missed contributionQuantify using estimated missed demand and the profit remaining after relevant variable costs.
Delayed purchaseTrack as a possible timing effect unless a later order clearly links back to the unavailable item.
Customer dissatisfaction or defectionRecognise as a risk; do not assign a precise cost without supporting customer evidence.
SubstitutionCount only the difference in contribution when the customer buys another product instead.

The formula in plain English

The core arithmetic is: estimated missed contribution = estimated missed demand × contribution per unit. At order level, use the equivalent formula: estimated missed orders × contribution per order. This measures the profit value that would likely have remained after the costs of making and selling those additional units.

Estimated missed demand is the number of units customers would probably have bought while the product was unavailable. It is a counterfactual, so it should come from a comparable in-stock period, adjusted for seasonality, promotions, traffic and channel mix. Do not automatically treat every visit or historical average as a lost unit.

Contribution per unit starts with the net selling price, then subtracts the variable costs that increase when one more unit is sold. Depending on the decision, those costs may include product cost, payment fees, fulfilment and shipping subsidies, returns allowance, and incremental advertising. Keep the scope consistent: contribution margin and ecommerce COGS are useful references for separating these costs.

This is different from missed revenue. Missed revenue = estimated missed units × net selling price. It describes sales that were never recorded; it does not describe the value left after costs. For illustration only, a product priced at £40 does not create £40 of stockout cost if £24 would have gone to product and other variable costs. The relevant contribution is the remaining £16, subject to the costs included in your model.

Revenue can therefore overstate the decision value of preventing a stockout. Use missed revenue to understand the size of the sales opportunity, and missed contribution to compare that opportunity with actions such as holding more stock or accepting a replenishment cost. Fixed overhead should not be subtracted again unless the analysis specifically concerns a cost that changes because of the decision.

A worked example from a Shopify store

Consider a Shopify apparel store whose $48 SKU is unavailable for seven days. The store’s comparable recent demand is eight units per day. A unit sells for $48, carries $18 of product cost, and incurs $8 in payment, fulfilment, and shipping costs, leaving $22 of contribution per realized unit. The merchant assumes that 25% of demand will be recovered after replenishment through delayed purchases; the rest is lost to substitution, abandonment, or timing.

The initial demand exposure is 8 × 7 = 56 units. After allowing for 14 recovered units (56 × 25%), the estimate is 42 unrecovered units. At $22 contribution each, the stockout cost is $924. Without the recovery assumption, the upper estimate would be 56 × $22 = $1,232. The difference shows why duration and customer recovery matter as much as the product price.

The $22 contribution should use the store’s own realized economics, not simply selling price minus product cost. For example, a merchant could validate the product cost treatment against ecommerce COGS and compare the result with contribution margin. The estimate supports a decision such as comparing the potential cost of a replenishment delay with the cost of holding additional units; it is not a precise count of customers who definitely would have purchased.

Worked stockout cost estimate for one Shopify SKU
InputAssumptionCalculationResult
Daily demand8 unitsComparable recent demand8 units/day
Stockout duration7 days8 × 756 units exposed
Recovered demand25%56 × 25%14 units
Unrecovered demand75%56 − 1442 units
Contribution per unit$22$48 − $18 − $8$22
Estimated stockout cost42 units42 × $22$924

Where the calculation goes wrong

The first error is treating revenue as the stockout cost. If a stockout appears to cover 10 missed orders at $40, the apparent loss is $400. But if each order would have produced $14 after product cost, payment fees, fulfilment and other variable costs, the missed contribution is $140. Revenue overstates the economic impact by $260. The right cost treatment depends on what is included in the store’s contribution view; keep product cost definitions consistent with ecommerce COGS and contribution margin.

The second error is assuming every unit in the baseline would have sold. A comparable period may show 10 units per day, but the stockout may have prevented only six purchases. Those six units produce a different estimate from treating all 10 as lost demand. The baseline can also be distorted by a promotion, payday timing, seasonality, traffic changes or an ad campaign that was no longer running. Use a comparable demand window and label the result as an estimate rather than a directly observed fact.

Substitution creates another double-counting risk. If a customer buys a similar $40 product instead, the store may have retained the order, with only the difference in contribution at risk. Counting the original product as a fully lost sale while also counting the substitute order as unaffected exaggerates the cost. Refunds create the same issue: if refunded or cancelled orders have already been excluded from realized revenue, subtracting their value again makes the stockout appear more expensive. A return may also belong in the store’s return rate and refund analysis, not automatically in the stockout estimate.

Finally, do not turn assumptions into precision. The share of demand that would have converted, the number of customers who substituted, and the contribution per unit may all be uncertain. Show a range: at six to eight missed units and $14 contribution each, the estimate is $84 to $112 per day. State which inputs are measured, which are inferred and which are unknown. That makes the stockout cost useful for comparing replenishment choices without presenting a scenario as recorded loss.

What a useful calculation tool should show

A useful stockout-cost tool should show the inputs behind every estimate, not just one dollar figure. At minimum, that means SKU or variant, stockout start and end dates, units available, recent demand, selling price, discounts, returns, cancellations, product cost, advertising cost, and currency. Shopify is the essential source for orders, products, customers, and inventory context. Advertising integrations matter when the estimate includes contribution after advertising rather than product margin alone. ORVX connects to Shopify and advertising accounts, calculates realized revenue from delivered orders only, and uses a product cost model for gross and net profitability.

Filters should make the comparison testable: product, variant, collection, market, channel, customer type, date range, and stockout window. The tool should also show whether the baseline uses the same weekdays, a prior period, or comparable products. A demand estimate that mixes a launch week with ordinary trading is not auditable. Product-level and collection-level profitability, contribution margin, returns, and remaining stock value provide useful context for deciding which cost basis belongs in the estimate.

Scenario controls should expose assumptions rather than hide them. Let the user change the comparable-demand period, exclude promotions or unusual orders, apply a substitution rate, and test different contribution-per-unit values. Attribution logic should state whether it counts only demand for the unavailable item, how cancellations and returns are treated, and whether advertising spend is allocated to that product or collection. Keep the merchant’s trading currency separate; a blended figure across currencies is not a meaningful result.

Finally, expect an audit trail: source systems, data refresh time, included orders, excluded orders, formulas, assumptions, and changes between scenarios. A result should be reproducible by another person. That standard also applies to inventory and carrying-cost context, which should remain distinct from product economics; see inventory carrying cost and ecommerce COGS.

Evidence a stockout-cost estimate should expose
AreaWhat to verify
DataOrders, inventory, product costs, returns, cancellations, ads, and currency
LogicDemand baseline, substitution, attribution, and contribution assumptions
ControlsDate, SKU, channel, collection, promotion, and customer filters
Audit trailIncluded records, exclusions, refresh time, formulas, and scenario changes

What to do with the answer

Use the estimate as an avoided-loss benchmark, then compare it with the incremental cost of each response. Keep the period, SKU, and currency consistent. For illustration only, if a stockout threatens 20 units at $12 contribution each, the estimated risk is $240. A $150 expedited shipment may be financially rational if it arrives while demand remains credible. By contrast, adding 10 units to safety stock ties up $80 at an $8 unit cost, plus the relevant inventory carrying cost, and may be less attractive if the SKU sells slowly.

The comparison supports a practical choice: expedite when the freight premium is below credible avoided contribution; increase safety stock when similar shortages recur and the carrying cost is acceptable; or change the reorder point when lead time and demand regularly leave the business exposed. If the estimate is uncertain, use a range rather than a precise-looking number. Compare the low and high cases against the proposed spend, including the risk of markdowns or dead stock.

Stockout cost cannot decide the action alone. It does not establish the right service level, forecast demand, set reorder quantities, or account for cash constraints, minimum order quantities, supplier reliability, substitutions, or whether demand will return after availability. Validate the contribution input against your ecommerce cost structure and use product-level profitability—not revenue alone—when deciding how much risk to accept.

Use the estimate to compare responses, not to automate the inventory decision.
OptionCompare againstDecision signal
Expedited freightFreight premium versus avoided contributionProceed only if delivery timing preserves credible demand
Safety stockExtra inventory cost and carrying costConsider when shortages recur and sell-through is reliable
Reorder-point changeHigher stock exposure versus repeated shortage riskConsider when lead time or demand variability is the underlying cause
Accept the riskExpected missed contribution versus cash and obsolescence riskReasonable when the estimate is low, uncertain, or costly to prevent

Stockout cost is most useful as a decision estimate, not a perfect accounting figure. Calculate the contribution margin at risk, make the assumptions visible, compare the result with the cost of preventing the shortage, and update the estimate as demand and replenishment data improve.