Stock that is wrong costs more than stock that is missing
Overselling is the failure customers remember. Someone buys the last unit, receives a confirmation, and then receives an apology two days later, which converts a sale into a refund and a complaint. It happens because the storefront holds a copy of a number that lives somewhere else, and the copy is refreshed on a schedule that made sense during development. A nightly synchronisation is fine for a slow moving catalogue and completely unsuitable for anything that sells in volume.
The design decisions are about ownership and latency. The ERP or warehouse system is normally the system of record, and the store either queries it at the decisive moment or holds a cache with a known age. Fast moving lines can carry a buffer so the last few units are not offered online. Stock can be reserved when a customer adds to cart or when they pay, and each choice has a consequence: reserve too early and abandoned carts hide inventory, reserve too late and you oversell.
Whatever is chosen has to fail sensibly. If the integration is down, the store should either stop taking orders for stock controlled lines or accept them into a queue that is clearly flagged, not silently sell against a stale number for six hours. Alerting on synchronisation failure belongs in the build rather than in an operational wish list, because the symptom of a broken stock feed is not an error page. It is a normal looking day with orders nobody can fulfil.
- A named system of record for stock, price and product data, agreed before build
- Synchronisation frequency chosen per line speed, with buffers on fast moving items
- An explicit reservation policy at cart or at payment, with the consequence understood
- Defined behaviour when the integration is unavailable, rather than selling on stale data
- Alerting on failed synchronisation, because a broken stock feed looks like a normal day