Running a shared stock pool without overselling
Running a stock pool shared across several shops, without overselling or lag, is a common type of project when the same business operates across multiple sales channels.
The typical need
A business sometimes sells the same physical stock across several online shops: a main shop and a shop dedicated to one range or brand, two shops targeting different countries, or a B2C shop and a B2B shop drawing from the same warehouse. Without a dedicated mechanism, each shop tracks its own stock figure independently, with a real risk of overselling: the same item sold twice on two different shops, when in reality only one is left.
How I approach this kind of need
The principle I use most often is a master/mirror architecture: one shop or system acts as the reference for actual stock, and the others mirror that value with synchronisation as fast as the context requires. The central question to settle before any development is when stock gets decremented: at add-to-basket, at order confirmation, or at shipping. Each choice has its own advantages and side effects, particularly on low-availability items.
I pay particular attention to race conditions: two orders placed almost simultaneously on two different shops for the last unit of the same item. The logic has to guarantee that only one of the two orders actually gets the item, with clear handling for the other — automatic refund, a substitute item offer, or a waiting list, depending on what the business can accept.
Factors that affect the quote
-
Number of shops involved
Syncing two shops is simpler than a network of several points of sale sharing the same stock.
-
Freshness requirement
Stock updated in real time needs a more robust architecture than syncing every few minutes, which is acceptable for some businesses.
-
Handling variants
A product with many variants (size, colour) multiplies the number of stock combinations that need syncing correctly.
-
Link to an external system
If actual stock is driven by an ERP or third-party management software, that system becomes the reference, adding an extra integration to the scope.
Frequently asked questions
Does stock have to be decremented at the basket stage?
Does this approach work with shops on different CMS platforms?
How are single-unit, high-demand items handled?
Does shared stock slow down product page loading?
Describe your need in one minute
A few targeted questions so I can reply with an estimate rather than another questionnaire.