Two customers open the same product page while a shop has one lamp left. Both pages correctly display that the item is available. A few moments later, both customers attempt payment. The stock problem begins when the system treats those two earlier page views as permission to sell the same physical object twice.
Preventing ecommerce overselling requires an explicit inventory model. A page can describe the latest known availability, but the final allocation needs a controlled operation that checks and changes the authoritative stock state together. A reassuring message in the browser cannot perform that allocation.
Name the inventory states your team actually uses
Consider a fictional handmade-lighting shop that sells through its website and a small showroom. Staff need to distinguish items physically present, items already committed to orders, items temporarily held during checkout and items unavailable because they need inspection. Calling every one of these states stock hides decisions that affect what can be sold.
Shopify's inventory documentation distinguishes several quantity states, including available, committed and reserved inventory. A custom application does not have to copy a provider's terminology, but it does need equally clear meanings. Write a short state table that explains who can move an item between states and which transitions affect availability.
Include the showroom sale in that model. If online and in-person channels draw from the same shelf, they need a shared allocation decision or a deliberately partitioned stock pool. Refreshing the website more often cannot compensate for a channel that never records its sales.
Reserve against an authoritative quantity
When a buyer reaches the point at which your business promises an item, create a reservation only if stock remains available. The check and reservation should form one atomic operation in the system responsible for inventory. Otherwise two requests can both read the final available unit before either one reduces it.
Attach the reservation to a recognizable checkout or order, rather than to a loose browser session. The same checkout retry should find its existing hold instead of reserving an additional lamp. Keep a durable record of the item, quantity, reservation owner and expiry rule so support can explain what happened.
These allocation rules belong in the backend implementation, where concurrent requests can be coordinated. A disabled purchase button is still useful feedback, but other clients and late requests must meet the same stock rule.
Decide how a reservation ends
A temporary hold needs a release policy. Explain whether it expires after inactivity, survives a payment redirect or ends when the buyer cancels. Show an understandable expiry message if the hold lapses while the customer is still using checkout.
Payment completion and reservation expiry can race. Define what the system does when confirmation arrives after the hold was released. It may need to recheck inventory and route an exception for resolution. Do not silently confirm fulfillment when the item has already been allocated elsewhere.
Also distinguish releasing a hold from recording a return. A returned lamp may need inspection before it becomes available again. Reversing the order quantity automatically can put an unsuitable item back on sale.
Reconcile the model with the shelf
Test simultaneous checkouts for one unit, repeated confirmation messages, a closed browser and a delayed payment result. Then compare the final inventory ledger with the expected physical allocation. Each successful order should have a corresponding commitment, and each expired hold should have a visible release.
Operational reconciliation matters after launch as well. Staff should be able to investigate a discrepancy without editing unrelated quantities until the numbers look plausible. Clear states turn a stock correction into an explainable action, which makes the next difficult checkout easier to diagnose.



