Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hi,
I'm in the process of building an integration with Shopify in my web application.
And I need to be able to see, when a product is updated, the previous and new inventory level for that product.
I can see that the 'products/update' webhook topic sends 'inventory_quantity' and 'old_inventory_quantity', however, 'old_inventory_quantity' is deprecated...
Is there a way to solve this with any other webhook topic, for example the topic 'inventory_items/update'?
I need:
– The new inventory level of a product variant
– The previous inventory level of a product variant
– OR the change / delta in inventory level of a product variant
Kind regards,
Gus
Solved! Go to the solution
This is an accepted solution.
I ended up solving my problem by using the orders/paid webhook and using the ‘quantity’ field for each variant.
Shopify should add ‘inventory_change’ to the inventory_level update webhook.
Hi @gubstav I believe the webhook you would use here is
inventory_levels/update
to see the currently available inventory https://shopify.dev/api/admin-rest/2022-04/resources/webhook
KB77 | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
I ended up solving my problem by using the orders/paid webhook and using the ‘quantity’ field for each variant.
Shopify should add ‘inventory_change’ to the inventory_level update webhook.
Hey,
I am doing something similar. I was hoping the inventory update webhook payload would contain some delta or I could create one with an "old_inventory_level" type property.
I went the same route as you decrementing inventory in my app based on the order created webhook.
However, I'm finding (especially with the "return" functionality) there are more inconsistencies around inverementing/restocking inventory in my app when dealing with cancellations/returns/refunds.
Did you find any consistent way of dealing with that?
Thanks!