I would like to prevent orders from being placed while an inventory update script runs.
We utilize a 3rd party warehouse management system (WMS) that has the final say in whether or not a part is in stock. Magento is configured to keep track of inventory (an order for 2 of SKU A will decrement SKU A's inventory by 2), but inevitably these systems become out of sync (due to defective or lost products, sales outside of Magento, etc). As such, we run an inventory sync every night where we request product counts from the WMS and update Magento with this data. The problem is that from the time we request the file until it finishes orders can still be placed in Magento and inventory can become out of sync. Since the update typically lasts ~15 mins, it was decided that Magento should just stop accepting orders during that time. Ideally, the site would still be navigable (is that a word?). I'd like to keep code changes to a minimum, but understand this probably cannot be achieved with configuration alone. A few of the avenues I've explored:
- Raise the minimum order amount to 9999999 and set an error message saying, "We are undergoing server maintenance, ordering is temporarily disabled"
maintenance.flagand remove when script completes
Alternatively, the inventory script can log the time it began and before updating inventory search for any orders from START_TIME until now to take into account anything the WMS did not know about. This seems like more work though and will certainly increase the processing time.