How can I effectively sync inventory levels with my application using webhooks?

3 0 0


I am trying to develop a simple inventory integration/sync with my application wherein my app is the source of truth for inventory levels data and I use shopify webhooks to alert my app when to decrement/increment inventory levels. 


I started down the path of using the inventory update webhook, but quickly found that without storing/cacheing the previous level for a product there was no way to create a delta as the webhook only contains the current overall inventory level and NOT the change in inventory level. It sounds like there used to be a property along the lines of "old_inventory_level," but that was deprecated. That or something like that would have solved my problem. 


Instead, I've gone the route of trying to use the order webhooks to know when to update inventory in my system. 

Order created webhook functions great to know when inventory needs to be decremented. 


I've subscribed to order cancellation and refund create webhooks to know when to restock items in my system.


However, I'm finding there is some inconsistency around the cancellation/refund/return logic/webhook notifications.


For instance, around the returns flow. I can return an item, restock the item, then refund the item. The refund webhook restock property is false in this instance despite the item having just been restocked in a different action.


Regardless, I am looking for some combination of webhooks to subscribe to and some consistent logic to use in order to know when to restock/increment inventory level in my system for a give product. 



Replies 0 (0)