Fix Library: Integrations and sync
Stock Levels Wrong After ERP Sync
Last updated:
What you see
After the ERP sync runs, products show the wrong stock, oversell, or show as out of stock when they are not.
Quick answer
Magento's Multi Source Inventory keeps two numbers: the quantity, and the salable quantity, which subtracts reservations for orders not yet shipped. Syncs that overwrite quantity without knowing about reservations, or run while orders are being placed, make the numbers drift. Check reservations first, then the sync timing and mapping.
What usually causes it?
- The sync sets quantity without accounting for open reservations
- Reservations left behind by orders that were edited, cancelled or imported
- The sync writes to the wrong source or stock
- Inventory indexes not updated after the sync
How do you check it safely?
These checks only read information. Run them on staging first if you can, from the Magento root folder as the file system owner. Hosting setups differ, so paths and service names may need adjusting.
- List reservation inconsistencies.
bin/magento inventory:reservation:list-inconsistencies - Check inventory indexer status.
bin/magento indexer:status inventory cataloginventory_stock - Compare one SKU in Magento (quantity and salable quantity) with the ERP at the same moment.
How do you fix it?
These steps change your store. Run them on staging first, with a backup of code and database.
- Create compensating reservations for the inconsistencies found, on staging first.
bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations - Reindex inventory.
bin/magento indexer:reindex inventory cataloginventory_stock - Change the sync so it accounts for open orders, or syncs only after orders are confirmed in the ERP.
- Check that the sync writes to the right source when you use more than one.
When should you call an expert?
Call an expert if you oversell during busy periods, or stock drifts again within days of a fix.
Need it fixed today?
I can look at it with you. Book a 20 minute call, or if the store is down, see emergency Magento support.
Further reading
FAQ
Common questions.
What is salable quantity?
The quantity Magento will still sell: physical quantity minus reservations for orders that are placed but not yet shipped.
Is it safe to create compensations on the live store?
It is a standard Magento command, but run it on staging first and take a database backup before running it live.
Related
Rather have it fixed for you?
Send a few lines about the problem, or book a 20 minute call. You get an honest read and a fixed quote.