How to prevent stockouts on Shopify

A stockout happens when a customer wants a product and you have none to sell. You prevent it by knowing when to reorder, holding a sensible buffer, and keeping supply dependable. This guide covers the formulas and routines that do that for a Shopify store.

What a stockout costs

The lost sale is the visible part. Other costs are easier to miss:

  • Lost future purchases. Some shoppers will buy from another store and may not return.
  • Wasted traffic. Ad clicks and email sends that point to an unavailable product are paid for and convert nothing.
  • Emergency replenishment. Rush freight and expedite fees can add cost compared with a planned order.
  • Distorted data. Zero sales while out of stock look like zero demand, which pulls later forecasts down. See the demand forecasting guide.

Prevention has a cost too. Every extra unit of buffer ties up cash, as the carrying cost guide explains. The aim is the right buffer per SKU, not the biggest one.

For a one-time buy, such as a seasonal order, the textbook rule balances the two costs:

Target service level = cost of being short ÷ (cost of being short + cost of being over)

Say an unsold unit costs you $3 in holding and markdown, and a unit you could not sell loses $12 of margin. Target = 12 ÷ (12 + 3) = 0.80. Order enough that demand falls at or below your quantity about 80% of the time.

The reorder point: when to order

Reorder point = (average daily demand × lead time in days) + safety stock

Lead time runs from placing the purchase order to having sellable stock, including production, transit and receiving. Demand and lead time must use the same time unit. The reorder point guide goes deeper.

Compare the reorder point with your inventory position, not only the units on the shelf:

Inventory position = on hand + on order − committed to unfulfilled orders

Say the reorder point is 150, you have 120 units on hand, 60 more are arriving in 4 days, and none are committed to unfulfilled orders. The inventory position is 120 + 60 − 0 = 180, which is above 150, so you do not reorder yet. Comparing only on-hand units (120 is below 150) would trigger a duplicate order while one is already in transit.

Safety stock: how much buffer

Safety stock covers variability in demand and in supplier lead time while you wait for replenishment. Two common methods follow.

Simple method: peak versus average

Safety stock = (maximum daily demand × maximum lead time) − (average daily demand × average lead time)

Say a product averages 10 units a day but peaks at 15, and the supplier averages 7 days but sometimes takes 10. Safety stock = (15 × 10) − (10 × 7) = 150 − 70 = 80 units. Reorder point = (10 × 7) + 80 = 150 units.

This method is conservative because it assumes peak demand and the longest lead time arrive together. It is easy to run for a few key SKUs but can hold more stock than needed.

Statistical method: choose a service level

Safety stock = z × √( L × σd² + d² × σL² )

  • d = average daily demand (units per day)
  • σd = standard deviation of daily demand (units per day)
  • L = average lead time (days)
  • σL = standard deviation of lead time (days)
  • z = the factor for your target service level
Target service levelz
90%1.28
95%1.65
98%2.05
99%2.33

Service level here means the chance of getting through one replenishment cycle without a stockout, not the share of time you are in stock. The formula assumes roughly normal demand, lead times that vary independently of demand, and demand that occurs regularly rather than in rare bursts.

Say d = 12 units a day, σd = 4, L = 14 days, σL = 3 days, and the target is 95% (z = 1.65).

Safety stock = 1.65 × √(14 × 4² + 12² × 3²) = 1.65 × √(224 + 1,296) = 1.65 × √1,520 ≈ 1.65 × 38.99 ≈ 64 units.

Reorder point = (12 × 14) + 64 = 168 + 64 = 232 units.

At a 99% target (z = 2.33), safety stock is about 2.33 × 38.99 ≈ 91 units. The step from 95% to 99% adds 27 units, roughly 40% more buffer.

The jump shows why service levels belong at the SKU level. See the safety stock formula guide for details.

Set service levels by SKU importance

Not every SKU deserves the same target. Rank products by revenue with ABC analysis, then set higher targets where a stockout hurts most. For example, a store might choose 98% for its top revenue SKUs, 95% for the middle group and 90% for the long tail. These are choices, not benchmarks, and each step up costs more buffer. Revisit the ranking regularly, since a SKU's importance changes.

Let the reorder point move with demand

A reorder point built on a long-run average goes stale when a promotion or seasonal peak falls inside the lead time. Use forecast demand over the lead time instead.

Say a product normally sells 10 units a day and the lead time is 14 days. A planned promotion will double demand to 20 units a day for 5 of those days. Demand over the lead time = (9 × 10) + (5 × 20) = 90 + 100 = 190 units, against 14 × 10 = 140 using the plain average. A fixed reorder point would fall 50 units short before any safety stock.

Build stock earlier ahead of known peaks, as covered in seasonal inventory planning.

Keep supply dependable

  • Record actual lead times. Compare order date with received date for every purchase order. The spread matters as much as the average, because it feeds the safety stock formula. See purchase order management.
  • Score suppliers. Track on-time delivery (orders received by the promised date ÷ orders received), order accuracy and lead-time consistency. Review them regularly.
  • Qualify a backup source for your highest-revenue SKUs. Place small test orders so the relationship exists before you need it, and weigh the extra unit cost against the cost of being short.
  • Check order sizes. Minimum order quantities and order cost affect how much you buy each time. The economic order quantity formula covers the trade-off.

Watch stock before it runs out

  • Days of cover = units on hand ÷ forecast daily demand. If you hold 90 units, demand is 10 a day and lead time is 14 days, you have 9 days of cover. With nothing on order, you would be out of stock for about 5 days even if you ordered today.
  • Alert at the reorder point, not at an arbitrary number such as "below 20", and give each alert an owner.
  • Check each location. Shopify tracks inventory per location, and a surplus in one location does not help another. See multi-location inventory management.
  • Review fast movers weekly. Compare sell-through (units sold ÷ units available at the start of the period) with each SKU's own normal range.

Plan for launches and promotions

New products and promotions are where forecasts are weakest. Pre-orders or a waitlist show real purchase intent before you commit to inventory. Pause or redirect ads for SKUs close to zero stock. Where an item will be unavailable for a while, backorders with an honest ship date can keep some orders. Guard against overbuying in response, since excess stock becomes dead stock.

If you do stock out

  1. Find the real restock date and ask the supplier whether, and at what cost, it can be expedited.
  2. Update the product page with an honest date, and offer a way to be told when it returns.
  3. Pause or redirect ads and emails that point to the product.
  4. Suggest in-stock substitutes.
  5. Tell customers with open orders what to expect.
  6. Log the date, days out and cause (late supplier, demand spike, bad data, wrong reorder point), then fix that input.

Common mistakes

  • Fixed buffers. A flat "keep 50 on hand" rule ignores that demand and lead time change.
  • Quoted lead times. Use what suppliers actually delivered.
  • Counting only on-hand units. This causes duplicate orders.
  • One service level for every SKU. It overspends on the long tail and underprotects the top.
  • Ordering extra out of fear. Padding every order raises carrying cost and dead stock.
  • Feeding stockout days into forecasts as zero demand.
  • Pooling variants. The popular size sells out while the others sit.

A starting checklist

  1. List your top SKUs by revenue.
  2. Record actual lead times from past purchase orders.
  3. Calculate safety stock and reorder points for those SKUs.
  4. Set service-level targets by SKU group.
  5. Review stock weekly against reorder points and log every stockout with its cause.