AI for Ecommerce Inventory Management: Reorder Points and Stockouts

Coding Liquids tutorial cover featuring Sagnik Bhattacharya for AI for Ecommerce Inventory Management: Reorder Points and Stockouts.
Coding Liquids tutorial cover featuring Sagnik Bhattacharya for AI for Ecommerce Inventory Management: Reorder Points and Stockouts.

Export sales and current stock by SKU, calculate average daily demand, then set each reorder point to expected sales during supplier lead time plus a deliberate safety allowance. Compare that point with stock on hand plus confirmed incoming units minus backorders. Use ChatGPT or Claude to inspect the CSV and explain outliers, but verify the maths in a spreadsheet before ordering.

The difficult part is not the multiplication. Sales history can understate demand during a stockout, incoming stock may be late, and one unusually large order can inflate an average. A useful AI-assisted process exposes those cases for a buyer to judge. It should never present a suggested quantity as a purchase order without checking pack sizes, cash and storage.

Follow me on Instagram@sagnikteaches

Build a SKU table that separates demand from availability

Start with two exports covering a known date range: order lines for units sold, and inventory for on-hand, reserved, backordered and incoming units. Join them on the exact sellable SKU or variant ID. A product name is a poor key because “blue bottle” may describe several sizes. Count units, not order lines: an order line with quantity four represents four units. Exclude cancelled orders and decide how returns affect demand. A returned item that can be resold changes available stock; it does not erase the original sale when you are measuring customer demand.

Connect on LinkedInSagnik Bhattacharya

Make a small table with columns for SKU, days in period, units sold, days unavailable, adjusted daily demand, supplier lead time, safety allowance, on hand, confirmed inbound, backorders, inventory position, reorder point and proposed quantity. Keep a note explaining each adjustment. OpenAI's help page on data analysis asks for descriptive headers in the first row and one row per record, and lists CSV among the files ChatGPT can analyse; Anthropic's upload guide lists CSV for Claude too. Either can help organise the work, but your stock system and supplier confirmations remain the facts.

Subscribe on YouTube@sagnikteaches

For an illustrative first check, SKU BK-12 appears on 28 order lines but sold 43 units because several customers bought multiples. If the model says “28 sold”, it has counted rows rather than quantity. A second SKU may have 10 returned units, of which only six passed a resale check. Add six to available stock after the warehouse has actually received them; do not count 10 as incoming. These small distinctions decide whether a proposed reorder is timely or wasteful.

Choose the sales window to fit the product. A stable consumable might start with eight weeks. A new product with one launch burst needs a different judgement. A seasonal item should be compared with a relevant prior period if you have reliable records, not simply the previous quiet month. Do not ask AI to “predict demand” from 14 days of sales and hide the uncertainty. Mark the SKU as low-confidence and review it more often. The broader inventory forecasting tutorial covers methods beyond a basic reorder trigger.

The Complete Excel Course with AI Integration thumbnail

The Complete Excel Course with AI Integration

From formulas and pivot tables to Power Query, DAX, VBA and AI with Copilot, ChatGPT and Claude — hands-on from the first lesson.

By Sagnik Bhattacharya and Virginia Thorn, Primetime Emmy Award winner

Buy now

Calculate a reorder point you can explain

The simple rule is: reorder point = expected demand during supplier lead time + safety stock. Lead time means elapsed days from placing an order until sellable units are available, not just the supplier's dispatch time. Safety stock is a deliberate buffer for late arrivals or demand changes. The number is a business choice that should reflect how costly a stockout is compared with holding spare units. Do not disguise an arbitrary buffer as an AI forecast.

Use inventory position for the comparison: on-hand sellable units + confirmed incoming units - backorders or committed units not already reflected in on-hand. Confirm what your stock system's “available” number already subtracts; subtracting reservations twice produces a false shortage. If inventory position is at or below the reorder point, prepare a purchase decision. If it is above, monitor. A reorder point tells you when to act; an order-up-to target or pack rule tells you how much to buy.

For example, an illustrative dog-accessory store sells an average of six units a day of a replacement lead, SKU DL-06. Its supplier normally takes 14 calendar days from order to sellable receipt. Expected lead-time demand is 6 × 14 = 84. The buyer adds 30 units of safety stock after reviewing recent variation and customer tolerance for delays. The reorder point is 114 units. That does not mean ordering 114 units whenever stock reaches 114; it means review a purchase when inventory position reaches that level.

Suppose on-hand stock is 95, a confirmed inbound order contains 40, and 12 customer backorders are outstanding. Inventory position is 95 + 40 - 12 = 123, so it is nine units above the 114-point trigger. If the inbound shipment is unconfirmed, counting it as certain is unsafe. Treat it separately, check the supplier date, and consider a contingency. A screenshot of a draft purchase order is not confirmed incoming stock.

A week later, on-hand is 75, confirmed inbound is 20, and backorders remain 12. Position is 83. It is 31 below the trigger, so the buyer prepares an order. Suppose the business reviews orders weekly and wants enough stock for the 14-day lead time plus the next seven days, then adds the 30-unit safety allowance. The illustrative order-up-to target is 6 × 21 + 30 = 156. Proposed units are 156 - 83 = 73 before pack sizes, minimum order quantity and cash checks. If the supplier sells in packs of 12, rounding up gives 84 units; the buyer should decide whether the extra 11 are acceptable. This is an order proposal, not a claim that demand will be exactly six every day.

Cross-check the calculation in a spreadsheet with ordinary formulas: `=UnitsSold/AvailableDays` for a basic daily rate, `=DailyDemand*LeadDays+SafetyUnits` for the trigger, and `=OnHand+ConfirmedInbound-Backorders` for position. If `AvailableDays` excludes stockout days, say so beside the formula. Keep the date window and lead-time source visible. The general reorder-point tutorial covers the wider stock logic; this ecommerce case has variant SKUs, online demand and order-status data that make the inputs easy to misread.

Let AI flag the rows that break the simple formula

AI earns its place by identifying anomalies in an export and explaining which assumptions need a human decision. Ask it to find missing SKU keys, negative stock, sales spikes, long zero-sales periods, duplicated order IDs and lead times that changed. It can rank rows for review. It cannot know whether the supplier will ship the next order on time unless you provide confirmed information. Keep any model-generated “confidence” label tied to stated evidence, such as “only 14 selling days” or “two stockout days”, rather than a made-up percentage.

Use the attached order-line and stock CSV files.
Join on exact variant_sku. Count quantity sold, not order lines.
Exclude cancelled orders. Show returns separately.
For each SKU, show sales days, unavailable days, units sold,
daily demand calculation, lead days, safety units, reorder point,
on hand, confirmed inbound, backorders and inventory position.
Do not count draft purchase orders as inbound.
Flag missing keys, duplicated order IDs, negative values,
stockout periods and unusually large single orders.
Show every formula and source row used. Mark assumptions clearly.
Propose an order only when position is at or below the point.
Do not send or create a purchase order.

Expect slips like this one. Given that file, the assistant might reply for BK-12 (illustrative): “Reorder now; 18 units sold in 30 days, demand 0.6/day.” The underlying CSV actually contains 18 order lines totalling 43 units. Correct the output to 43/30 = about 1.43 units a day, then inspect whether any of the 30 days were unavailable. The correction matters because a 14-day lead time gives about 20 units of expected demand, not eight or nine. A plausible-looking table can still be wrong at the first aggregation step.

A second example is a promotional spike. SKU LE-08 normally sells four units daily, but one wholesale order of 120 units made the last month's average eight. Ask AI to isolate that order ID and show daily demand with and without it. Then decide whether another such order is likely. Do not automatically discard the spike; if wholesale replenishment is a recurring part of the business, it belongs in a separate planned-demand line. The model should expose the choice, not make it silently.

A third case is censored demand during stockouts. A café's online shop sold 40 bags of a blend in 20 available days and none during the next 10 days because it had no stock. A naive 30-day average is 1.33 bags per day. The observed available-day rate is two per day, though even that may miss customers who did not return. Mark the estimate as uncertain and use pre-stockout orders, waitlists or customer enquiries if available. The goal is a defensible starting point, not a false precision.

Reconcile the store's stock definitions before buying

Online stores often expose several numbers for the same SKU: physical on hand, available to sell, reserved for open orders, committed to returns, inbound and at another location. Write down which field your reorder formula uses. If “available” already subtracts reservations, do not subtract backorders again unless they are genuinely outside that figure. If stock is held at two fulfilment sites, a global total may hide a local stockout. Calculate at the location where the order is actually fulfilled, then review possible transfers separately.

For an illustrative location check, 60 units sit at site A and 50 at site B. The store shows 110 globally, above a 90-unit trigger. But 90% of orders ship from A and a transfer takes four days. A's 60 units may need action now even though the global number looks comfortable. AI can show both views if location is in the export. It should not assume all 110 are interchangeable. The buyer may transfer, split fulfilment or order externally depending on actual operating costs.

Bundled products create another trap. A bicycle-repair kit sold as one bundle consumes two inner tubes and one patch pack. Ten kit sales are ten bundle units, but 20 tubes. If the stock export tracks components, calculate demand at the component SKU level. Ask the model to show the bill-of-materials mapping supplied by your team and flag missing components. It must not invent bundle contents from a product title. The same principle applies to samples and replacements given away without a normal sale: they consume stock even when order revenue is zero.

Supplier lead time needs evidence too. Your previous three receipts took 11, 14 and 21 days from order to sellable check-in. A 14-day average may be too optimistic if a 21-day delay would empty the shelf. You might use a higher planning lead time or retain more safety units, then review the holding cost. Do not claim the model has calculated a statistically sound service level from three observations. Record the actual receipt dates and revise the rule as more orders arrive.

If a supplier has a minimum order value across many SKUs, a trigger on one low-priced item need not justify an immediate large order. Create a candidate list and show the gap to the minimum, shelf capacity, cash requirement and expected days of cover. The assistant can assemble the comparison; the buyer chooses whether to wait, combine items or pay a small-order charge. Avoid ordering slow movers merely to satisfy a threshold. Use the slow-mover tutorial to examine those products separately.

Use a weekly buying review, with urgent exceptions

For most small stores, a fixed review day makes the process manageable. Refresh the sales and stock exports, recalculate the trigger, then inspect only SKUs at or below it plus any item with a supplier delay or stock discrepancy. Mark each proposal “buy”, “wait”, “transfer”, “check count” or “discontinue”, with a reason. Save the decision next to the calculated numbers. A model suggestion without a recorded buyer decision cannot explain why an order was or was not placed.

Before issuing a purchase order, verify the supplier SKU, pack multiple, minimum quantity, unit cost, delivery window, existing orders and available cash. A reorder calculation based on six units a day could suggest 73 units, while a case pack forces 84. The 11 extra units have a cost and storage requirement. Conversely, ordering only 72 to stay within budget may knowingly accept a higher stockout risk. Record that trade-off rather than asking AI to describe the smaller order as safe.

After receipt, compare forecast and reality. Did units arrive by the assumed lead day? Did sales during lead time match the 84-unit estimate in the worked example? Did a stockout happen despite the 30-unit buffer, or did unused stock pile up? Track three simple figures per SKU: days out of stock, units left when replenishment arrived, and days of cover after receipt. If a trigger repeatedly creates excess, lower the allowance or revisit demand. If it repeatedly misses, inspect lead-time volatility and missing demand.

Use a manual pilot on perhaps ten meaningful SKUs before scaling the calculation across the catalogue. Include a fast seller, a slow seller, a variant, a bundle component and an item with erratic supplier delivery. This reveals data mistakes that a single tidy SKU cannot. Keep the first few buying cycles under human approval. The purpose of AI for ecommerce inventory management is to make the buyer's evidence clearer and the exceptions faster to find, while each order still follows the store's commercial judgement.

Check the proposed quantity against the next real constraint

A mathematically correct order can still be the wrong commercial decision. Put three columns beside the proposal: cash needed, shelf space needed and expected cover after receipt. For an illustrative SKU costing $8 per unit, the 84-unit case-pack order needs $672 before any other charges. If only $500 is available for this supplier this week, the buyer must revisit the pack, delivery date or another SKU. The model should not quietly reduce the order to an impossible 62.5 units or pretend the shortage risk has vanished.

For a perishable bakery product sold online, the shelf-life limit may be more important than the supplier minimum. Suppose a mix sells five units daily, arrives in cases of 24, and has only 10 useful days after receipt. Four cases mean 96 units, almost 19 days of sales at the observed rate. Even if a formula suggests four cases to cover a long lead time, the buyer needs to question whether those units can be sold before expiry. A smaller, more frequent order or a different supplier might be preferable. Record the waste risk alongside the stockout risk.

A product with several colour variants presents a different constraint. A dog-grooming store may sell 60 replacement collars monthly, but 45 are black, 10 blue and five red. Applying the product-family average of two per day to each variant would order far too many blue and red units. Export order lines by exact variant, calculate each rate, and mark low-volume colours for manual review. If a customer will accept a colour substitution, that is a separate business rule; the AI should not assume it.

Consider a supplier whose quoted lead time is 14 days but whose last order is already eight days late. The inventory position formula normally includes that purchase as incoming, yet it may no longer be reliable for an urgent decision. Run two scenarios: “confirmed arrival in two days” and “arrival in 10 days”. For the six-unit daily item, the difference is 48 units of demand. Ask the supplier for an actual dispatch update before paying for an emergency order. The comparison makes the consequence clear without pretending the model can predict the shipment.

For a new product, there may be no sales history at all. Do not copy the rate of the most similar item without saying why it is a proxy. Start with a small opening quantity that the business can afford to hold, set a frequent review date, and record the first sales and enquiries. If marketing will feature the product next week, include that known plan. AI can list assumptions and compare plausible low and high cases, but a reorder point derived from zero historical sales would misleadingly say “never buy”.

The buyer's sign-off sheet should record the formula result and the reason for any override. For example: “DL-06: trigger 114, position 83, formula suggests 73, pack-adjusted 84; approved 84 because the supplier confirmed the lead time and storage is available.” Or: “LE-08: trigger crossed; wait two days because a promotional order inflated the recent rate and the buyer is checking repeat demand.” These two decisions are different, but both can be audited later. That makes the next revision of the rule more evidence-based than simply trusting the assistant's latest answer.

Further reads

Sources: OpenAI documentation, Data analysis with ChatGPT; Anthropic documentation, Upload files to Claude (checked November 2026).

Want reorder rules that survive a stock check?

On a 1:1 AI implementation consultation, we can map your sales and stock exports, calculate a small SKU pilot and set the review step before anyone places purchase orders.

Book a 1:1 call with me