Your sales history records what customers bought, not what they wanted. On a day a product is out of stock it sells zero units, and that zero goes into every report, average and forecast as if nobody wanted it. Statisticians call this censored demand: the true number is somewhere above what you observed, and the data cannot tell you how far above.
The cost is large across retail. IHL Group estimates that inventory distortion, the combined cost of out-of-stocks and overstocks, costs the global retail industry $1.73 trillion a year, with about $1.2 trillion of it attributed to out-of-stocks. For a single store the question is more practical: which products lost how much, and is the forecast making it worse?
Two distortions, not one
Researchers studying vending machines described the problem precisely more than 25 years ago: when an item stocks out, its sales are right-censored, while sales of other items are inflated because of substitutions. Both effects matter. The product that ran out looks less popular than it is, and the product customers settled for looks more popular than it is. Reorder both based on raw sales and you get the next stockout and an overstock at the same time.
What customers do when the product is gone
Not every stockout is a lost sale. The best-known study of shopper reactions, by Daniel Corsten and Thomas Gruen, found that when confronted with an out-of-stock, 26 percent of shoppers switch brands, 31 percent switch stores, 19 percent substitute within the same brand, 15 percent delay the purchase, and 9 percent do not buy at all. That research covered physical stores. Online, switching to another site costs one search, and the split differs: a later study reported that in the U.S., 15 percent of shoppers who hit an online out-of-stock bought elsewhere, while 60 percent bought a substitute from the same merchant.
| Shopper response | Effect on the stocked-out product | Effect on your store |
|---|---|---|
| Buys a substitute from you | Lost unit | Revenue partly kept; substitute’s sales inflated |
| Waits and buys later | Unit shifted to a later date | Kept, if they come back |
| Buys from a competitor | Lost unit | Lost sale, possibly a lost customer |
| Does not buy at all | Lost unit | Lost sale |
Those published splits are useful as a starting assumption. Your own substitution rate can be measured, and the method below shows how.
Step 1. Start keeping stock history
You cannot estimate lost sales without knowing when a product was out of stock, and neither WooCommerce nor Magento keeps that history by default. Both store the current quantity. WooCommerce exposes it in the wp_wc_product_meta_lookup table; Magento in cataloginventory_stock_item, or inventory_source_item with multi-source inventory. A scheduled job that copies the current values into a snapshot table once a day (or every hour for fast sellers) is enough:
-- WooCommerce: run daily, or hourly for fast movers
INSERT INTO stock_snapshot (snapshot_at, product_id, stock_quantity, stock_status)
SELECT NOW(), product_id, stock_quantity, stock_status
FROM wp_wc_product_meta_lookup;
Until that history accumulates, you can approximate stockout days from the order log: a product that normally sells every day and then records several consecutive zero days is probably out, not unpopular. Treat that inference as provisional.
Step 2. Estimate demand on stockout days
There is a ladder of methods. Most stores get most of the value from the first two rungs.
| Method | How it works | When it is enough |
|---|---|---|
| 1. Exclude | Drop stockout days when computing averages and velocity | Always; this alone removes the downward bias |
| 2. Impute from in-stock days | Replace each stockout day with the average of the same weekday over recent in-stock weeks, scaled by trend | Steady sellers, short stockouts |
| 3. Partial-day adjustment | For days out of stock part of the time, scale by the share of normal daily sales that usually happen during the in-stock hours | Fast sellers that run out mid-day |
| 4. Substitution adjustment | Subtract the extra units that similar products sold during the stockout | Products with close substitutes in your catalog |
| 5. Censored demand models | Statistical models that treat stockout days as “at least this many”, such as Tobit regression | Large catalogs, frequent stockouts, a forecasting team |
For rung 4, compare the sales of the closest alternatives (same category, similar price) during the stockout with their usual rate. The difference is substituted demand. It is revenue you kept, so subtract it from the lost-sales estimate. It is also demand that did not belong to the substitutes, so remove it from their history before forecasting them.
A worked example
A hypothetical product sells for $40 and normally sells about 12 units a day. It was out of stock for four full days and for the last 6 hours of a fifth day, during which half of its usual daily sales typically happen.
| Stockout exposure | 4 full days + 0.5 of a day = 4.5 day-equivalents |
| Expected unit demand during stockout | 4.5 x 12 = 54 units |
| Demand at full price | 54 x $40 = $2,160 |
| Measured substitution into similar products | 35% of that value |
| Estimated net lost revenue | $2,160 x 0.65 = $1,404 |
Repeat this across the catalog each month and rank products by net lost revenue. The top of that list is usually short, and it is a much better reorder priority list than “units sold last month”.
Why this breaks forecasts, and how the loop closes
A forecast trained on censored sales learns that demand is lower than it is. The next purchase order is smaller, the product runs out sooner, and the next round of data is more censored still. The authors of a recent stockout-annotated retail dataset describe exactly this self-reinforcing cycle, in which models trained on censored sales underestimate true demand. Seasonal models are affected too: a stockout during last year’s peak teaches the model that the peak was smaller.
The fix is to forecast from the corrected series, not the raw one. Feed the imputed demand from Step 2 into whatever forecasting method you use. QuantumLayers explains how its Holt-Winters and SARIMA forecasts decompose trend and seasonality in How QuantumLayers Forecasts Time Series; those methods produce better forecasts when the input reflects demand rather than availability.
Signals of demand you are already collecting
- Product page views while out of stock. GA4
view_itemevents on a sold-out page, divided by the product’s normal view-to-purchase rate, give a second independent estimate of missed units. - Back-in-stock requests. Waitlist sign-ups are a floor on demand and a list of customers to contact first when stock arrives.
- Site search for the product name. Searches that end on a sold-out result are demand you can count.
When the order-based estimate, the page-view estimate and the waitlist all point the same way, you can trust the number enough to change a reorder quantity. When they disagree, look at whether a substitute absorbed the demand.
Sources
- IHL Group, Retail Inventory Crisis Persists Despite $172 Billion in Improvements (September 2025)
- IHL Group, Fixing Inventory Distortion: Who’s Winning, Who’s Failing, What’s Working
- Anupindi, Dada and Gupta, Estimation of Consumer Demand with Stock-Out Based Substitution, Marketing Science (1998)
- Corsten and Gruen, Online Availability, Springer (2019), summarizing their 2002 worldwide out-of-stock study
- Retail Dive, Online out-of-stocks cost $22 billion in sales
- Wang et al., FreshRetailNet-50K: A Stockout-Annotated Censored Demand Dataset, arXiv (2025)


