Ecommerce Website Developer

JournalAbout 2 min read

What happens when stock sync fails

Overselling is a symptom. The cause is usually an integration with no defined behaviour for the moment the other system stops answering.

Written by

Nazir AbbasApproved contributor

Contributed by

Javed IqbalApproved contributor

Published

Abstract measured panel in the brand colours

Key takeaways

  • Three failure modes: stale data, partial updates and race conditions
  • Deciding what to do with stale stock is a commercial choice, not a technical default
  • Stopping sales only on low-stock lines is usually the right middle ground
  • Store the last successful sync time where the application can read it
  • Alert when that timestamp exceeds the expected interval
  • Reconcile fully on a schedule and report the differences

An integration that only works when the other system answers is not finished. It is a demonstration.

Stock synchronisation is where this shows up most expensively, because the failure mode is selling something you do not have.

The three ways it goes wrong

  1. Stale data. The sync stopped hours ago and nobody noticed, so the shop is selling from a snapshot.
  2. Partial updates. Some products updated, some did not, and there is no way to tell which from the shop side.
  3. Race conditions. Two orders for the last item arrive within the sync interval and both succeed.

The first is the most common and the easiest to prevent. The third is the hardest and needs a decision rather than a fix.

Decide what the shop does when stock data is old

This is a commercial decision, not a technical one, and it should be made by the business rather than defaulted by the code.

Options when stock data cannot be trusted
BehaviourTrade-off
Keep selling from the last known figuresMaximises orders, risks overselling
Show items as available but flag longer dispatchHonest, slightly reduces conversion
Stop selling affected linesSafest, costs orders immediately
Stop selling only low-stock linesA reasonable middle, needs a threshold

The last one is usually the right answer. Items with plenty of stock are low risk; items with one or two left are where overselling happens.

Make staleness visible

The shop should know how old its stock data is. That means:

  • A timestamp on the last successful sync, stored where the application can read it
  • An alert when that timestamp exceeds the expected interval by a defined margin
  • A visible indicator in the admin, so staff know before customers do

An integration that fails silently will fail silently for a week.

Reserve stock at the right moment

Deciding whether to decrement stock at basket, at checkout start, or at payment confirmation is a genuine trade-off between abandoned reservations and overselling. There is no universally right answer, but there is a wrong one: not deciding, and discovering the behaviour in production.

Reconcile regularly

Whatever the sync does in real time, run a full reconciliation on a schedule and report the differences. The differences are where the bugs are, and they are much easier to understand as a weekly report than as an angry customer email.

Frequently asked

Questions readers ask

Why does my ecommerce site oversell products?

Usually because stock data is stale and nobody noticed, because a sync partially failed, or because two orders for the last item arrived inside the sync interval. The first is the most common and the easiest to prevent with a staleness alert.

When should stock be reserved: basket, checkout or payment?

It is a genuine trade-off between abandoned reservations and overselling, and there is no universally right answer. There is a wrong one: not deciding, and discovering the behaviour in production.

What should a shop do when stock data is out of date?

Decide in advance. Options are to keep selling, show longer dispatch times, stop selling affected lines, or stop selling only low-stock lines. The last is usually best, because items with one or two left are where overselling happens.

About the authors

Nazir Abbas

Written by

Nazir AbbasApproved contributor

Web Developer & Co-Founder

Builds and maintains ecommerce sites in React, Next.js and WordPress, and handles the technical side of search.

Javed Iqbal

Contributed by

Javed IqbalApproved contributor

SEO Specialist & Co-Founder

Leads search, with more than five years in ecommerce and technical SEO for businesses in the UK, the US and the UAE.

Editorial process: every article is written by one of the two co-founders and reviewed by the other before publication. Technical claims are checked against how the systems actually behave, and anything we cannot evidence is left out rather than asserted.

Related reading