Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
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 5 and inventory_quantity as 6
but both of them are the same. Could anyone please explain what is happening here ?
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 ?
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
To learn more visit the Shopify Help Center or the Community Blog.
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 ?
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?
Yeah, that's absolutely terrible. And still unchanged and confusing people after after 3 years.
Typical Shopify attitude of not giving a shit.
It's so difficult for the Shopify team to add a delta value field 🙂