Solved

Webhook sending previous and new inventory level

gubstav
Tourist
4 1 0

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

Accepted Solution (1)

gubstav
Tourist
4 1 0

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.

View solution in original post

Replies 3 (3)

KB77
Shopify Staff
59 6 11

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

gubstav
Tourist
4 1 0

Hi @KB77,

 

That webhook does not provide the previous inventory level – only the available amount.

gubstav
Tourist
4 1 0

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.