Why Product/Update webhook returns same amount for Inventory Quantity and Old Inventory Quantity

nqm149
Tourist
4 0 1

so in this case, I updated product quantity ( 5 -> 6 ) from admin dashboard.
It triggers the inventory/update and product/update webhook.
From products/update webhook response, I expected to see old_inventory_quantity as and inventory_quantity as 6
but both of them are the same. Could anyone please explain what is happening here ?
products/update webook responseproducts/update webook response

the Inventory/Update webhook also get fired like the following :

{
    "inventory_item_id": 31752488419414,
    "location_id": 34379694166,
    "available": 6,
    "updated_at": "2019-10-15T16:21:34+09:00",
    "admin_graphql_api_id": "gid://shopify/InventoryLevel/34157822038?inventory_item_id=31752488419414"
}

but only returns "available", which doesn't help me to compare with old quantity, where can I find the products quantity before the change ?
 

0 Likes
vix
Shopify Staff
Shopify Staff
535 105 106

 

Hi @nqm149 

 

 

old_inventory_quantity is a deprecated field, meaning we are not currently supporting or suggesting to utilize this field. It also will not provide you with information such as the location where the inventory was sold from, which is why we recommend that you instead use the inventory_levels/update webhook and listen for any updates to that. You can track the current inventory level and store that for comparison upon update if needed. Our updated documentation can be found here: https://help.shopify.com/en/api/reference/inventory/inventorylevel

 

 

Vix | Developer 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

nqm149
Tourist
4 0 1

Hi @vix 
Thanks for your reply. 
I see, I also found a similar discussion about this problem here : https://community.shopify.com/c/Shopify-APIs-SDKs/Does-the-product-update-webhook-let-me-know-if-an-... 
According to the answers of above thread, basically if I want to find out when a product is sold out or back in stock, I need to keep track of the quantity by storing the number in my own database. Is that correct ?


0 Likes
huytx
New Member
1 0 0

Hi @nqm149 @vix 

I'm still looking for an answer for this thread. 

Did you guys find a solution for this, it would be a huge help.

Thanks

0 Likes
greekTRUE
Tourist
6 0 0

Why does Shopify continue to send this field in their webhooks if it's deprecated? If anything, you should send old_inventory_quantity: "deprecated" or something like that.

You may argue that you don't want to break existing code that is relying on this, but you've already broken it by making the number inaccurate. You tricked me into thinking I would be able to rely on that field. So, what, are you just going to leave that field in your webhooks forever?

0 Likes