Connecting an Online Store to ERP: How to Prevent Stock Errors and Duplicate Orders
Four separate data flows instead of a general “sync”, one decision on who holds the truth about each piece of data, and why every connection needs a waiting queue with a unique identifier instead of an immediate call that fails silently.
In short
“Sync” between a store and a management system is really four separate data flows, each with its own direction and its own working pace, and the critical decision in all of them is the same: who holds the truth about each piece of data. For stock, the truth sits in the ERP, but the store also needs a temporary reservation for carts and for orders that have not gone through yet, otherwise two customers may buy the same last unit. And every interface needs a queue that waits and a unique identifier for every message, because an immediate call that fails quietly creates an order that vanished or an order that was duplicated.
Four flows, not one
| Flow |
Direction |
Required pace |
What breaks when it does not work |
| Catalog and prices |
From the ERP to the store |
Once a day is usually enough |
A wrong price on the site. Annoying for the customer, easy to fix, in most cases not critical |
| Stock |
From the ERP to the store, with a reservation in the store |
As fast as possible, and under load it is measured in seconds |
Selling an item that does not actually exist. This is the expensive failure, the one that damages customer trust, not just money |
| Orders |
From the store to the ERP |
Immediately, but through a queue |
An order that vanished or an order recorded twice. Both happen silently, and that is exactly what makes them especially difficult |
| Shipping and refunds |
From the ERP to the store |
Per event |
The customer calls to ask where the package is. The cost here is in service time and frustration, not necessarily in direct money |
The required pace is different for each of the four flows. A project that tries to build one uniform mechanism for all of them will either build it for the strictest requirement and pay for that in resources, or build it for the most lenient one and fail on stock. Separating the flows is a basic design decision, not a cosmetic improvement.
Stock: why the ERP alone is not enough
The truth about stock levels has to be in the ERP, because that is where quantities from the supplier come in and where quantities shipped to the customer go out. That is correct, but on its own it does not solve the problem.
The problem is the window between choosing and paying. A product sitting in a shopping cart has not been sold yet, so the ERP does not know about it. If two customers reach the same last unit seconds apart, both will see it as available, both will pay, and one of them will end up getting the phone call no business wants to make.
The solution is a temporary reservation in the store: the unit is held for the customer for a defined period, and the allocation is cancelled if the purchase is not completed. This decision requires two clear business choices, and neither is technical:
- How long to hold it. Too short frustrates serious customers, too long unnecessarily reduces the stock available to buy.
- What to do when stock is zero anyway. Block the purchase, or allow it and mark it as a special order. Both options are legitimate, but the choice has to be final and agreed in advance, otherwise it will be decided by whatever was easiest to implement.
A check you can run today. Measure how long it takes in your business from the moment the last unit is sold until it is removed from the site, during peak hours, not in the morning. That number represents your risk of stock discrepancies, and it is also the main measure of what improving the mechanism is worth.
A queue, not an immediate call
This is one architectural point that cannot be cleanly patched in after the fact, so it is worth thinking through before development starts.
An integration built as an immediate call assumes that the other side is always available and responsive. In practice, the ERP may be in the middle of an update, the network may go down, and the process may be overloaded. If the order was sent and no response came back, the store does not know whether it was recorded: sending it again may create a duplicate order, and not retrying may make it disappear.
Two components solve this together, and both are needed:
- A queue that waits and retries. The order enters a queue on the store side, and the queue empties itself when the ERP starts responding again. The customer does not wait for this process to finish.
- A unique identifier for every message, with the ERP ignoring any message whose identifier it has already received. Without such a mechanism, a second attempt creates a second order, and the duplicate only surfaces later, in the accounts.
And a third question that needs a clear written answer: who tells someone that the queue is not emptying. A queue that gets stuck silently is more dangerous than a visible fault, because nothing looks broken until the month-end close or a manual check reveals that something does not add up.
One identifier, and it is not obvious
An organization that sells online usually has three identifiers for the same item: the store's internal ID, the item number in the ERP, and the supplier's barcode. They do not always match, and sometimes one of them is missing altogether.
The decision that saves you most future bugs is to choose one identifier that everyone translates to, and to keep a single translation table in a central place that is easy to look at and update. It looks like a boring decision, it does not feel like project progress, and so it is almost always postponed. After that, every catalog fault turns into an investigation.
The case that shows this most clearly is variants: the same product in different sizes or colors. If the store lists each variant as a separate item and the ERP defines it as an attribute of one item, or the other way around, every stock update will only be approximate. On the broader consequences of the same question: custom software development and data migration.
Digital invoices and the moment of purchase
The move to invoices issued through the Israel Tax Authority affects the store precisely at its most sensitive point: the end of the purchase.
Issuing an invoice stops being a purely local action. The invoice takes on a status with an outside party, which can be slow, fail or be refused. A store that keeps the customer waiting for an answer from that outside party will look broken exactly at peak load moments.
So the two have to be separated: payment approval is one thing, invoice issuance is another, and the customer completes the purchase once payment is approved. The invoice is issued through a queue, using the same logic of retries and a unique identifier, and with clear responsibility for who gets alerted if it was not issued. Related: invoice processing (in Hebrew), procurement management.
How we work on this
In the field since 2004, working on AI systems since 2023, with projects for clients in fourteen countries. We are not a platform vendor and we are not affiliated with any manufacturer, so the conclusion “do not replace the store and do not replace the ERP, fix two flows” is a legitimate outcome, and in this field a common one.
A professional review defines the four flows, with the owner of the truth and the right pace for each, sets the reservation period and the behavior when stock is zero, establishes the canonical identifier and the translation table, and measures the time it takes to remove a sold item during peak hours as a baseline for improvement.
Where to start
Measure one figure: how long it takes in your business from the moment the last unit is sold until it comes off the site, during peak hours. That number shows whether you have an integration problem between the store and the management system, or whether things are stable.
Talk to us | Related: e-commerce, ERP and CRM systems, integrations
SLAtech LTD