Integrating an ERP With Your Online Store: Patterns That Hold Up
Which system should own products, stock, prices, orders and customers, how to sync them without blocking checkout, and the error queue and daily reconciliation that keep an ERP and a store in agreement.

An ERP ecommerce integration looks like an API project and behaves like an ownership dispute. The code that moves an order from the store to the ERP is the easy part. The hard part is deciding which system is right when they disagree about a price, a stock level or a customer's address, and what happens to the message that could not be delivered at two in the morning.
The decisions below determine whether an integration runs quietly for years or needs someone to fix orders by hand every Monday.
Give every piece of data exactly one owner
For each kind of record, one system is the source of truth and the other receives copies. When both can edit the same field, the last write wins and nobody knows which value is correct. This is the split that works for most stores:
| Data | Owner | Flows to | Notes |
|---|---|---|---|
| Product basics: SKU, name, cost, tax class, weight, barcode | ERP | Store | New products are created in the ERP first |
| Product content: descriptions, images, categories, SEO fields | Store (or a PIM) | Nowhere | The sync must not overwrite these |
| Stock | ERP or warehouse system | Store | The store never sets stock, it only reserves it |
| Base prices and customer price lists | ERP | Store | Promotions and coupons stay in the store |
| Orders | Store, until exported | ERP | After export the ERP owns status, shipment and invoice |
| Shipment status and tracking | ERP or warehouse | Store | Triggers the customer email |
| Retail customers | Store | ERP | Often posted against one generic account |
| Trade accounts, credit terms | ERP | Store | The store reads terms, it does not set them |
Write your own version of this table before any development, and have finance, the warehouse and whoever runs the store agree to it. Many of the integration bugs we are asked to fix trace back to a field that two teams each believed they controlled.
Agree on shared keys
The two systems need a reliable way to recognize the same thing. For products that is the SKU, identical on both sides down to leading zeros, spaces and letter case. Clean the SKUs before the first sync and stop anyone renaming them afterwards.
For everything else, store the other system's ID on your record: the ERP customer number on the store customer, the ERP sales order number on the store order, the store's order ID on the ERP document. With both IDs saved on both sides, a re-sent message updates the existing record and does not create a second one.
Three sync patterns and where each belongs
Events as they happen
The store announces that something occurred, usually through a webhook: order created, order paid, refund issued. This is the right pattern for orders, because the warehouse wants them within minutes. Its weakness is delivery. A webhook sent while the receiver is down may be lost unless something retries it, and platforms give up eventually. WooCommerce, for instance, disables a webhook after repeated failed deliveries, so a long ERP outage can silently switch your order export off.
Polling on a schedule
Every few minutes, one side asks the other for records changed since the last successful run, using a "modified after" timestamp or a change counter saved between runs. This suits stock and prices, which change in the ERP and where a delay of a few minutes is acceptable. Polling is also self-healing: if a run fails, the next one picks up the same changes.
Scheduled batches
A nightly file or bulk API call that carries the full catalog, price list or stock snapshot. Many older ERPs only offer file exchange, and even with a modern API a nightly snapshot corrects whatever the faster syncs missed.
Durable integrations combine all three: events for orders, polling for stock and price changes, and a nightly full comparison.
Put a queue between the store and the ERP
Never call the ERP from inside the checkout request. If the ERP is slow or offline, the customer waits or the order fails, and your store's uptime now depends on your back office. The checkout should save the order and finish. A background worker then sends it on.
The queue in the middle needs four properties:
- Every message is stored before it is sent, with its payload, so nothing depends on a single HTTP call succeeding.
- Sending is safe to repeat. The worker checks for the store's order ID in the ERP before creating a sales order, so a retry after a timeout does not create a duplicate.
- Failures retry with growing delays, then move to an error queue after a set number of attempts.
- The error queue is visible to a person. A screen that lists each stuck message, the ERP's error text and a "retry" button, plus an alert when anything lands there.
That last point separates integrations people trust from ones they do not. An order rejected because the ERP does not recognize a new shipping method is a business problem, and someone in operations should be able to see it, fix the mapping and resend without calling a developer. We go further into this in designing integrations that survive third-party API failures.
Stock is more than one number
The ERP's "on hand" figure is not what the store should display. What can be sold is on-hand stock minus quantities already allocated to open orders, minus anything held for other channels. Decide which figure the ERP exposes and make sure the store receives the sellable one.
Between syncs, the store has to protect itself. It should reduce its own available quantity as orders are placed and treat the next ERP update as a correction. For fast-moving items a small safety buffer, where the store shows a little less than the ERP reports, absorbs the delay. You also need a policy for the occasional oversell: backorder, substitute or refund. Bundles need their own rule, since the ERP usually tracks the components and the store sells the set. If you also sell on marketplaces or in a shop, keeping store, marketplace and POS inventory in sync covers the wider problem.
Order details that cause rejections
An ERP validates far more strictly than a store does. These are the fields that most often send an order to the error queue:
- Tax. The store and the ERP may round per line or per order, and a difference of one cent can fail validation. Decide which system calculates tax and have the other accept its figures.
- Shipping and fees. The ERP often wants these as line items with their own item codes.
- Discounts. A coupon across the whole cart has to be spread over lines or posted as a negative line, depending on how finance wants to report it.
- Payment method. Each gateway needs a mapping to a payment term or ledger account.
- Units of measure. The store sells "1 box", the ERP stocks "12 each".
- Addresses. Required fields, country and state codes, and length limits differ.
Then define what happens after export. In most setups nobody should edit an order in the store once the ERP has it: changes, cancellations, partial shipments and returns are made in the ERP and flow back. Refunds issued in the store need a matching credit note in the ERP, mapped with the same care as the order.
Reconcile daily, even when nothing looks wrong
Monitoring tells you a message failed. Reconciliation tells you the two systems disagree, which can happen with no failure at all. Schedule a daily job that compares and reports:
- orders paid in the store with no sales order number from the ERP after a set time,
- order counts and totals per day on both sides,
- SKUs where store stock and ERP sellable stock differ,
- SKUs where prices differ,
- products active in one system and missing or inactive in the other.
Send the report to a named person. When it shows a difference, fix the cause and not only the record, or the same mismatch will be back next week.
Packaged connector or custom ERP ecommerce integration
If you run a mainstream store platform and a mainstream ERP, look for a maintained connector first. When your process is standard, a connector that many other companies use will be cheaper and better tested than anything written for you alone. Check that it has retries, a visible error log and configurable field mapping.
Custom integration is justified when the ERP is older, heavily modified or industry-specific, when you have customer-specific pricing, multiple warehouses or unusual tax rules, or when the available connector cannot map the fields you need. We build these as a small middleware service with its own queue and admin screen, for WooCommerce stores and custom platforms alike. Our CRM and ERP systems page covers the ERP side, and API development and integration covers the connecting layer.
Frequently asked questions
Does stock need to sync in real time?
Rarely. A sync every few minutes plus local reservation in the store is enough for most catalogs. True real-time stock matters for items with very low quantities and high demand, and those are usually better protected with a safety buffer or a purchase limit.
Should orders go to the ERP when placed or when paid?
When paid, in most businesses, so the warehouse never picks an order that was abandoned at the payment step. The exception is trade customers buying on account, where the order is valid as soon as it is placed and the ERP checks the credit limit.
What happens to orders while the ERP is down for maintenance?
With a queue, nothing is lost. The store keeps taking orders, messages wait, and the worker delivers them when the ERP returns. Stock is not refreshed during the outage, so raise safety buffers before a long maintenance window.
Add worldwincoder.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.
