Mike
Mike

Reputation: 331

Wrong product stock when importing magmi with pending orders

I'm syncronizing an ERP software with Magento via Magmi.

Consider the following: all available units of a product are in a pending order, so the product is not available in the store. If a Magmi product import is done while the order is pending, the product’s stock returns to the original quantity and it goes back to the store. This means the stock won’t be correct until there’s another import from the ERP software after the order is fulfilled.

Am I missing something? If not, how easy is it to set the correct product availability upon the import?

I imagine it's "only" a matter of subtracting the product quantities present in pending order to the quantities being imported. Of course, the worst case scenario is probably the product already being out of stock in the ERP software and thus ending up with negative stock.... and more importantly, with a dissatisfied customer.

I probably could minimize the risk of ending up with negative stock by synchronizing more often, but I'm still dependant on how quickly the website orders are fulfilled.

Thoughts?

Upvotes: 1

Views: 790

Answers (1)

Daniel Sloof
Daniel Sloof

Reputation: 12706

You want to make sure that there is 1 true resource for your (stock) data. Because stock updates are coming from ERP to Magento, we can argue that ERP is the leading resource. In that case you can consider use a real-time update towards the ERP when an order is set to pending (use an observer on sales_order_save_after).

This way, you'll have the following situation:

  1. Product stock is imported to magento.
  2. Order is placed and is pending.
  3. Real-time update is done and ERP receives updated stock (decrement).
  4. Now you have 2 situations:
    1. Order is cancelled and ERP receives updated stock (increment).
    2. Order succeeded, no update towards ERP required.

This way, the ERP is always aware of how Magento perceives your stock and there will not be any issues when you receive a 'full' stock update towards Magento.

Upvotes: 1

Related Questions