How to Sync PrestaShop Stock with an ERP Across Warehouses — Odoo & ERP article by Rui Codex

Sync stock from one source of truth, the ERP, into PrestaShop as available-to-sell quantities per warehouse, reserve stock when orders are placed, and push changes on every movement rather than in a nightly batch. Overselling happens in the gap between a sale and the next update, so shrink that gap and hold a safety buffer for the rest.

Key takeaways

  • Overselling is a timing problem: it occurs when two sales read the same stock figure before either one updates it.
  • Choose one system as the owner of physical stock, and treat every other system as a consumer of its numbers.
  • Calculate a single available-to-sell quantity per product from all warehouses, minus reservations and a safety buffer.
  • Test the sync with concurrent orders and failed API calls before you rely on it in production.

Why does overselling happen across several warehouses?

Overselling happens when a website sells units that the business does not physically have available to ship. With one warehouse and one stock figure, the risk is small. With three locations, each holding its own count, the risk grows because the storefront must combine several numbers that change at different moments.

The core problem is latency. A customer buys a unit in one location while another order, a goods receipt or a manual count is still waiting to reach the storefront. Each of those events is correct on its own, but the storefront shows a figure that is already out of date.

Which sync model should you choose?

The right model depends on how fast your stock moves and how many systems can change it. Most setups fall into one of three patterns: a scheduled batch, an event-driven push, or a hybrid where events update the storefront and a scheduled reconciliation corrects drift.

ModelStrengthWhere it fails
Scheduled batchSimple to build and easy to auditStock is stale between runs, so fast sellers oversell
Event-driven pushStorefront reflects movements quicklyLost or out-of-order messages leave wrong numbers without warning
Hybrid with reconciliationFast updates plus a regular correction of driftMore moving parts to monitor and maintain

For most multi-warehouse businesses, the hybrid model is the practical choice. Events keep the storefront close to reality, and a scheduled full comparison catches the errors that events inevitably miss. PrestaShop exposes its stock and web service features through its own documentation at the PrestaShop project site, and the exact endpoints you use should be checked against the version you run.

How should available-to-sell stock be calculated?

Available-to-sell is the one number the storefront should show: physical stock across the warehouses that can ship to that customer, minus units already reserved by open orders, minus a safety buffer you set deliberately. Showing raw warehouse totals is the most common cause of overselling.

Tip: Decide per product whether a sale may draw from any warehouse or only from a designated one. Pooling stock across locations is simpler, but it hides shortages in the location that actually ships the order.

Reservations and the order lifecycle

A reservation should be created when the order is accepted, not when it is shipped. If reservations only exist after picking, two customers can buy the same unit during the hours between checkout and warehouse processing. Release the reservation if payment fails or the order is cancelled.

The safety buffer

A buffer protects against counting errors and damaged goods. Keep it small and explicit, and review it when returns or shrinkage rise. A hidden buffer that nobody remembers setting becomes a source of unexplained lost sales.

Setting up the sync step by step

A reliable setup starts with clear ownership and ends with monitoring. Work through the steps in order, because later steps depend on the data model defined earlier.

  1. Define the system of record for physical stock per warehouse, normally the ERP or warehouse module.
  2. Map every PrestaShop product and combination to a unique ERP item code, and check for duplicates before go-live.
  3. Agree the warehouse-to-shipping-zone rules so the storefront knows which locations can serve which orders.
  4. Build the available-to-sell calculation in one place, not in both systems.
  5. Send reservation events from PrestaShop when orders are confirmed and release them on cancellation.
  6. Run a scheduled reconciliation that compares both systems and logs every difference.
  7. Alert a named person when differences exceed a threshold you define.
Tip: Log the stock value sent, the value received and the time of each message. When a customer disputes an order, these logs answer the question of what the storefront showed at that moment.

If you need help designing this kind of flow, the ERP and CRM integration service page describes how such connections are typically scoped. Our system integration work covers the broader picture of connecting systems that were never designed to talk to each other.

Where does the sync fail?

The sync fails most often at the boundaries between systems rather than inside them. A message can be dropped, arrive twice, or arrive out of order, and any of these can leave the storefront with a figure that looks plausible but is wrong.

  • Duplicate messages subtract the same sale twice. Use idempotent handlers keyed on the order and line identifier.
  • Out-of-order messages can overwrite a newer quantity with an older one. Include a timestamp or version number and ignore stale updates.
  • Manual adjustments in the warehouse may never trigger an event. Reconciliation is the only reliable catch for them.
  • Variant mismatches occur when a combination exists in one system but not the other, so its stock is never updated.
  • Failed API calls leave gaps unless failures are retried and visible on a dashboard.

Each failure mode needs an owner and a check. A sync that works on a normal day can still fail on a sale day, when order volume and concurrency peak together, so test under those conditions before launch.

Hypothetical examples

Here are two hypothetical scenarios: the first describes a fashion retailer with a central warehouse and a store-based shipping location, and the second describes a parts distributor that ships from two regional depots.

In the first scenario, the retailer pools stock for online orders but reserves a share of the central warehouse for in-store collection. The storefront shows the pooled figure minus that reserved share. The risk is a customer buying the last pooled unit while the store is also selling it; the fix is a shared reservation event, not two separate counters.

In the second scenario, the distributor assigns each depot to a fixed region. The storefront uses the depot that serves the delivery postcode, so a shortage in one depot does not hide stock in the other. The risk is a regional bestseller running out while the other depot holds plenty, which a simple total would hide. The fix is per-depot available-to-sell figures and a rule for when to transfer stock between depots.

Frequently Asked Questions

Can PrestaShop stock be synced in real time?

Real-time sync is possible when the ERP or warehouse system pushes an event on each stock movement and PrestaShop receives it promptly. In practice, most teams accept a short delay and add a reconciliation job, because a single lost message is otherwise invisible until a customer complains.

Do I need one stock figure for all warehouses?

You need one available-to-sell figure per product for the storefront, but you can still track stock separately per warehouse in the ERP. The combined figure is derived from the warehouse counts, reservations and buffer, which keeps the storefront simple without losing location detail.

How often should reconciliation run?

Reconciliation frequency should match how quickly stock changes and how costly a wrong figure is. Many teams run it several times a day for fast-moving catalogues and less often for slow lines, and they review the differences found rather than only counting them.

What should happen when an order is placed for a product that is out of stock?

The order should be rejected or put on backorder according to a rule the business has agreed in advance. Accepting it silently and resolving it later creates unplanned shortages, delayed deliveries and avoidable customer contact.

Conclusion

Preventing overselling across several warehouses is less about any single tool and more about discipline in ownership, calculation and monitoring. Decide which system owns physical stock, calculate one available-to-sell figure, reserve stock when orders are accepted, and reconcile on a schedule. Test concurrent orders and failed messages before launch, because those are the moments when a sync is most likely to break. If you want to discuss your setup, request a project consultation at Rui Codex or email info@ruicodex.com.

Sources

Tags: PrestaShop ERP integration stock synchronisation multi-warehouse overselling API integration inventory management workflow automation

Need Help Implementing This?

Our team can help you put these insights into practice. From AI automation to custom software development, we build solutions that deliver real results.

Send a project request