Home / Guides / Two stores sell the last unit

What happens when two stores sell the last unit at the same time

Every app that syncs stock between Shopify stores has a short window in which two stores can sell the same last unit. We build one of those apps, and we would rather explain the window than pretend it isn't there. Here is how it happens, how often it matters, and how buffers make it rare.

The timeline of a sale

Inside a single store, Shopify handles stock for you: if "Continue selling when out of stock" is off, the store stops selling at zero. Across two stores, nothing on Shopify's side connects them, so an app has to carry the news. That takes a few steps:

  1. A customer checks out in store A. Shopify lowers store A's count.
  2. Shopify notifies the sync app with a webhook. Shopify describes webhooks as "near-real-time" (Shopify developer docs), meaning after the event, not at the same instant.
  3. The app works out the new shared count.
  4. The app writes the new count to store B through the Admin API.

Between step 1 and step 4, store B still shows the old number. That gap is the window. It is usually short, but it is never zero, for any app built on Shopify's public APIs.

A worked example

MomentRetail storeOutlet storeReal units on the shelf
Beforeshows 1shows 11
Customer X buys in retailshows 0still shows 10 (promised to X)
Customer Y buys in the outlet, inside the windowshows 0shows 0−1: one order can't be filled
The app's update arrivesshows 0set to 0 (never negative)−1

Both checkouts succeeded because, at the moment each customer paid, their store really did show one unit.

When the window matters

For two orders to collide, both have to land on the same SKU, when it has very few units left, inside a short window. For most catalogs that combination is rare. It becomes realistic when:

We don't publish a percentage for how often this happens, because it depends entirely on your traffic and catalog. Stockpact logs each case so you can see your own rate.

How buffers shrink the risk

A buffer is a number of units a store hides. The real stock doesn't change; the store just shows less. Put a buffer of 1 on the outlet and repeat the example:

Shared stockRetail showsOutlet shows (buffer 1)
332
110

When only one unit is left, only the retail store sells it, so there is nothing to collide. The window still exists for the second-to-last unit, but the chance that both stores sell two units of the same SKU within seconds is much smaller.

Practical rules:

How big should a buffer be?

There is no published benchmark, so start small and adjust from your own log. For reference, merchants in the Shopify Community describe rules like these (anecdotes, not measurements):

A simple way to start: buffer of 1 on the lower-priority store for items that usually sit at five units or fewer, and 5% on fast sellers. After a month, look at which SKUs still collided and which sat at "0 shown" with stock on the shelf, and move the numbers.

The buffer trade-off: stuck stock

A buffer on every store hides the same units everywhere. With a buffer of 1 in both stores, the last unit shows as sold out in both, and nobody can buy it. That is lost revenue, not safety. Keep at least one store without a buffer for each item, and check the log for items that sit at "0 shown" while the shared stock is above zero.

The other risk: updates that never arrive

The window is about timing. A different failure is an update that never arrives at all. Shopify states that webhook delivery isn't always guaranteed and that ordering isn't guaranteed, and it recommends reconciliation jobs that fetch data periodically (source). An app that only listens to webhooks will drift slowly, and you find out when an order can't be filled. Ask any sync app how it catches missed updates.

What Stockpact does, and what it can't do

What it does

  • Keeps one sellable count per SKU and writes the absolute number to each store, not "+1/−1".
  • Handles events for the same SKU one after another, and applies a repeated event only once.
  • Never shows a negative number; when it has to set a store to zero, it logs and counts it.
  • Buffers per store, collection, tag or SKU, as a number or a percentage.
  • Scheduled reconciliation plus a "reconcile now" button to catch missed updates.
  • A log of every change with before, after and cause, and a restore button.
  • Shows the measured sync delay for your stores in the app.

What it can't do

  • Close the window to zero. No app built on Shopify's public APIs can.
  • Stop a store from selling a unit it was showing at the moment of checkout.
  • Choose which of two colliding orders to cancel. That is a customer decision, and it stays yours.

If it happens: a short playbook

  1. Check the real shelf. Sometimes a returned or miscounted unit is there after all.
  2. Keep the first order, contact the second customer quickly. Offer a similar item, a back-order date or a refund.
  3. Cancel and refund in Shopify so the stock and the customer record are right.
  4. Look at the log. Was it the timing window, or a missed update? The first calls for a buffer; the second for a reconciliation check.
  5. Add or raise a buffer on that SKU or its collection in the lower-priority store.

Have a polite template ready, so the second customer hears from you quickly and gets a clear choice.