Skip to main content

Inventory and Order Management Workflow: A Template for a Growing Online Shop

In this article

An inventory and order management workflow that survives growth has three parts. Stock is tracked as four separate numbers (on hand, reserved, allocated and incoming) and the figure shoppers see is derived from them, never typed in. Every order moves through a fixed list of states, and each transition does one defined set of things to stock, to the customer and to the warehouse. And every change to a stock number is written as a movement with a reason, so the current figure can always be explained.

The template below is the workflow we build into Django shops and back offices. It is the set of rules that stops the same item being sold twice, keeps the pick list honest and makes the stock count match the system. Where a shop runs on spreadsheets, these are the rules the spreadsheet has been quietly breaking.

The four stock numbers and the one you show

A single "quantity" column is the root of most overselling: once an order is placed but not packed, that number is wrong for the website or for the warehouse. Four numbers remove the ambiguity.

  • On hand: units physically on the shelf, including ones promised to orders.
  • Reserved: units held by baskets that have not paid yet. Reservations expire.
  • Allocated: units belonging to paid orders that have not been dispatched.
  • Incoming: units on purchase orders that have not arrived, with an expected date.
@property
def available(self):
    return self.on_hand - self.reserved - self.allocated

Available is what the product page shows and what the basket checks. Incoming is what the page can use to say "more expected on 24 October" instead of a blank "out of stock". Reservation and allocation both have to be atomic, a single conditional update rather than a read followed by a write. The post on stock holds and drops for specialty shops has the code for that. A shop with subscriptions adds a fifth number, units committed to renewals due in the next fulfilment window, which the post on selling products and subscriptions together describes.

The order states

An order is a state machine. The states are few, the transitions are the only places stock changes, and nothing else in the system is allowed to alter a stock number by hand.

StateEntered whenWhat the system does
PendingCheckout opensReserves the basket's units with an expiry
PaidPayment webhook confirms the chargeConverts reserved to allocated, sends the confirmation, adds the order to the pick queue
PickingA packer takes the pick listLocks the order to that packer so two people do not pick it
PackedEvery line scanned into the boxReduces on hand and allocated, records the serial or batch where there is one
DispatchedCarrier label createdStores the tracking reference, emails the customer, closes the pick
DeliveredCarrier reports deliveryStarts the returns window, triggers the review request
CancelledCustomer or staff cancels before dispatchReleases reserved or allocated units, refunds if paid
ReturnedReturned item scanned inRestocks if resaleable, refunds the line, records the reason

The transition into Paid is the one most shops get wrong. It must be driven by the payment provider's webhook, not by the customer reaching a thank-you page, because a share of customers never reach it. The plain-English guide to webhooks explains how that message arrives and why it has to be handled so that a repeat delivery does not allocate stock twice.

The workflow, step by step

  1. Basket to Pending. When the checkout opens, each line is reserved with a ten-minute expiry, extended when the shopper reaches payment. A task releases expired reservations every minute.
  2. Payment to Paid. The webhook handler locks the order row, checks it is still Pending, moves it to Paid, converts reserved units to allocated and queues the confirmation email, all in one transaction.
  3. Pick lists. Orders are grouped into pick runs by cut-off time, and within a run sorted by shelf location so the packer walks the warehouse once.
  4. Pack with a scan. Each item's barcode is scanned into the order. A scan that does not match a line is rejected on the spot, which is where most mis-shipments are caught. The order cannot move to Packed with a line unscanned.
  5. Label and dispatch. The system chooses the carrier service from weight, size, destination and the delivery option the customer paid for. It creates the label through the carrier's API (Royal Mail Click and Drop, DPD and Evri all have one) and prints it to the thermal printer. The tracking reference is saved and the dispatch email goes out with it.
  6. Delivery and after. Carrier tracking updates arrive by webhook or a scheduled poll and move the order to Delivered, which starts the returns window and any review request.

The dispatch promise on the website should be derived from this workflow, not guessed. Stamp and Bake, a Bristol shop for 3D-printed cookie cutters, promises orders posted within two to three working days and shows Royal Mail postage in the cart. That promise holds because the cut-off, the pick runs and the label step are fixed.

Stock movements: the audit trail

Every change to on hand is a row in a movements table. The row holds the product, the quantity (positive or negative), the reason, the order or purchase order it relates to, who did it and when. Reasons are a fixed list: sale, return, supplier receipt, stock take adjustment, damage, sample, transfer. On hand is the sum of movements, and a nightly check compares the sum with the stored figure and flags any product where they differ.

This is what makes a stock count possible. A count becomes a set of adjustment movements with a reason, each attributable to the person who counted. It is also what answers "why does the system say we have three when there are none": the movements for that product tell the story in order.

Receiving stock, reorder points and other sales channels

Receiving and reordering

  • Purchase orders are records, not emails. A purchase order lists what was ordered from which supplier, at what cost, with an expected date. Its lines are the Incoming figure until they are received.
  • Receiving is a scan too. Goods in are scanned against the purchase order; discrepancies are recorded there and then, and the receipt creates the supplier receipt movements.
  • Reorder points come from sales rate and lead time. A fixed threshold of ten units is wrong for a product that sells thirty a week and wrong for one that sells one. The alert should fire when projected stock, at the recent sales rate, runs out before the supplier's lead time ends, with seasonal uplift where last year's data shows it.
  • Alerts go somewhere someone looks. A daily email or a dashboard panel listing products below their reorder point, with the suggested quantity and the supplier, is more useful than a flag buried in the product record.

Selling on more than one channel

A shop that also sells through a marketplace or a physical till has to decide which system holds the truth. The answer is one system, with every other channel receiving availability from it and sending orders to it.

Marketplace orders are pulled by API on a schedule and created as orders in the same state machine. So they go through the same pick, pack and dispatch steps and the same stock movements. Availability is pushed back out after every change, with a safety buffer per channel for the few minutes between a sale and the push. That is because a marketplace oversell costs more in penalties than a lost sale does. The introduction to APIs and when a website needs one covers how those connections are built and kept reliable.

A back office at this stage has warehouse logins, a packing screen, carrier and marketplace integrations and reporting. It is a system in its own right rather than a page in the shop admin. It is the kind of thing we scope as one of the web platforms we build in stages.

Returns and the reports worth having

Returns in the same system

A return is not a special case; it is a state. The customer requests it in their account, picks a reason, and receives a label. When the item is scanned back in, the system asks one question, resaleable or not. It then either creates a return movement that restocks it or a damage movement that does not. The refund is issued through the payment provider with an idempotency key tied to the return, so it cannot be issued twice, and the order line is marked Returned. The reasons feed the return-rate report.

Reports worth having

  • Orders by state right now, with anything in Picking for longer than a day flagged.
  • Dispatch against promise: the share of orders dispatched within the stated window, by week.
  • Products below reorder point with suggested quantities.
  • Stock value on hand at cost, by category, for the accountant.
  • Return rate and reasons by product.
  • Mis-ship rate, which the scan step should drive towards zero.

The KPI tracking template for web apps covers how to define measures like these so that the numbers mean the same thing every month.

Questions people ask

When should stock be deducted: at order, at payment or at dispatch?

Reserve at checkout, allocate at payment, deduct on hand at packing. Each step changes a different number, and the figure the website shows is derived from all of them.

Can a spreadsheet work as an inventory system?

For a handful of products and a few orders a day, yes. It fails when two people edit it, when a marketplace sells something it does not know about, or when nobody can say why a number changed.

Do I need barcode scanning for a small warehouse?

If mis-shipments or wrong-item returns happen more than occasionally, yes. The scan step is the single most effective check in the workflow.

How do I stop overselling on a marketplace?

Hold the master stock figure in one system, and push availability to the marketplace after every change. Keep a small buffer per channel for the delay between a sale and the push.

Where to start

Start with the four stock numbers and the movements table, because every other part of the workflow depends on them. Then wire the Paid transition to the payment webhook and the Packed transition to a scan. Those two changes remove most oversells and most mis-shipments on their own.

Carrier integration, reorder points, marketplaces and reporting can each be added as a stage once the core is holding. Build them in the order they are costing you time, and check the nightly stock reconciliation before adding each one.