Forecasting Math · Bestseller Protection

Stockout-Adjusted Demand Forecasting for Shopify

Standard Shopify sales reports count zero-sale stockout days as zero demand. Here is how the stockout death spiral quietly drains your highest-margin SKUs — and the exact clamped velocity math used to stop it without risking small-sample over-orders.

By Inoetic Engineering Updated December 2026 6 min read

1. The Stockout Death Spiral Explained

Almost every growing e-commerce brand has experienced this paradox: your single best-selling SKU sells out mid-month, yet your reorder spreadsheet tells you to order fewer units next time than you ordered last time.

The culprit is censored demand. When Shopify marks a variant as sold out (available ≤ 0), shoppers cannot purchase it, so daily sales drop to zero. A naive forecasting tool divides total units sold over the lookback window by total calendar days:

Naive Daily Velocity = Units Sold in Window ÷ Lookback Calendar Days

If a bestseller sells 10 units per day for 18 days and then spends 12 days out of stock, it logs 180 units sold in 30 days. Naive math calculates 180 ÷ 30 = 6.0 units/day — a 40% underestimate. When you reorder based on 6.0 units/day, the next shipment runs out even earlier in the month, pushing next month's naive average down to 4.5 units/day. Over three cycles, your highest-margin product starves for stock while slow movers accumulate surplus capital.

2. In-Stock Velocity & Safe Clamping Formulas

Stockout-adjusted forecasting removes out-of-stock days from the denominator — and adds two statistical guardrails so edge cases (such as a SKU that was only in stock for 1 day during a flash drop) never blow up your purchase order.

Raw Daily Velocity = Units Sold ÷ Lookback Days Actual In-Stock Days = max(0, Lookback Days − Out-of-Stock Days) // Guardrail 1: Minimum in-stock denominator floor (default = 5 days) Effective In-Stock Days = max(Actual In-Stock Days, min(Lookback Days, Min In-Stock Floor)) Unclamped Velocity = Units Sold ÷ Effective In-Stock Days // Guardrail 2: Maximum uplift multiplier cap (default = 4.0× raw velocity) Adjusted Daily Velocity = min(Unclamped Velocity, Raw Daily Velocity × Max Uplift Cap) Effective Daily Velocity = Adjusted Daily Velocity × Seasonality Multiplier
Why both guardrails matter: Imagine a seasonal SKU that sat at zero stock for 29 days, received a tiny 15-unit return batch on Day 30, and sold all 15 units to back-in-stock email subscribers that afternoon. Unclamped math predicts 15 units/day (450/month!), which would cause a massive overbuy. With a 5-day floor and 4× uplift cap, velocity is safely clamped to min(15 ÷ 5, 0.5 × 4) = 2.0 units/day until genuine multi-day sales history accumulates.

3. Numeric Comparison Across 4 Real Store Scenarios

The table below compares naive 30-day velocity, unclamped in-stock velocity, and StockPilot's clamped velocity (5-day floor, 4× uplift cap) across four real Shopify merchandising cases with a 30-day lookback and 30-day reorder lead + buffer window:

SKU Scenario (30-Day Window) Units Sold / OOS Days Naive Velocity Unclamped Adjusted Clamped Velocity 30d Stock Delta vs. Naive
Steady In-Stock Core SKU 300 units / 0 OOS 10.0 / day 10.0 / day 10.0 / day 0 units (exact match)
Mid-Month Bestseller Stockout 180 units / 10 OOS 6.0 / day 9.0 / day 9.0 / day +90 units protected
Severe Supplier Delay Stockout 140 units / 20 OOS 4.67 / day 14.0 / day 14.0 / day +280 units protected
1-Day Restock Spike (Edge Case) 15 units / 29 OOS 0.50 / day 15.0 / day (overbuy!) 2.00 / day (4× cap) Prevents 390-unit overbuy

4. Why Daily Stock Snapshots Beat Order-Date Guessing

Shopify's Admin API stores historical order timestamps, but it does not expose a native daily historical inventory ledger per variant and location. Some apps try to guess stockouts by scanning for gaps between orders. That heuristic breaks immediately on medium-velocity SKUs (where 3 days with zero orders can simply be normal variance, not a stockout) and fails completely on multi-location setups where Store A is sold out while Warehouse B still has stock.

Running an automated daily inventory snapshot per SKU (and per location on Multi-Location plans) records ground-truth availability each day. Every day where available ≤ 0 increments the verified out-of-stock day counter for that lookback window, giving your purchasing team auditable numbers instead of guesswork.

5. Combining Stockout Adjustment with Seasonality & Safety Stock

Stockout-adjusted velocity tells you true recent demand under normal stock availability. Two additional levers handle forward-looking risk:

6. Forecast Calibration Checklist

7. Frequently Asked Questions

Why does standard 30-day average daily sales under-order Shopify bestsellers?

Standard 30-day velocity divides units sold by all 30 calendar days even when a variant was out of stock and unbuyable for part of the month. Dividing by 30 instead of actual in-stock days suppresses apparent demand and causes progressively smaller reorders.

What happens if a SKU was only in stock for 1 or 2 days during a 30-day window?

Without clamping, a brief restock burst can extrapolate into a massive over-order. StockPilot enforces a minimum effective in-stock denominator floor (default 5 days) and a maximum velocity uplift cap (default 4× raw velocity) to prevent small-sample explosions.

How should I choose between 30-day and 60-day lookback windows?

Shopify's standard read_orders scope provides the last 60 days of order history, so StockPilot supports 7-, 14-, 30-, and 60-day lookback windows. Use 30 days for fast-moving consumer goods and active paid-ad campaigns, 60 days for balanced apparel, homeware, or slower-turning SKUs that need the full 60-day baseline, and 7- to 14-day windows when measuring short promotional surges.

Stop Under-Ordering Your Shopify Bestsellers

Try StockPilot's stockout-adjusted velocity engine, landed-cost calculator, and 1-click vendor POs free for 14 days — flat US$39/mo with zero GMV tax.

Start 14-Day Free Trial Open Interactive Calculator