Will products/update webhook always fire when an inventory level is updated?

Shopify Partner
22 0 3

Will products/update webhook always fire when an inventory level is updated?

 

In other words, if the 'available' quantity is changed, is it guaranteed that the underlying variant's product webhook will fire (so that we can use the variant.inventory_quantity in the webhook?)

 

I did a quick test and it seems that the products/update does fire but I also wanted to ask if that is always the case?

 

Thank you!

0 Likes
Shopify Staff
Shopify Staff
1105 77 144

Hey @ClementBR , 

 

I actually hadn't thought that the webhook fired when an order was placed that decremented an inventory count, but looks like it does - same with updating in the admin and making an API call to change the inventory level. Looks like it does in fact always fire! 

0 Likes
Shopify Partner
22 0 3

Oh really ?!

It definitely didn't use to fire the product webhook when an order was placed.

But maybe that changed when multi-inventory was released.

 

I hate to be a pain, but is there some sort of more official answer that the product webhook will indeed fire whenever the variant's quantity changed, directly or indirectly because of an order or inventory level update?

 

It is critical for us to keep the variant inventory in sync. Historically we have queried back the API whenever a order webhook or inventory level webhook fires, just to be safe.

It works, but the downside is that we end up making  A LOT of API calls. Basically any time we get  a order/inventory_level webhook we have to query back into the API. 

0 Likes
Shopify Staff
Shopify Staff
1105 77 144

I was as surprised as you were! I knew that inventory_levels/update webhooks fired, but I know that for the longest time products/update webhooks didn't. 

 

You're not being a pain at all - I'll do some digging to make sure products/update is safe to use for this purpose and I'll get back in touch ASAP. 

0 Likes
Highlighted
Shopify Partner
22 0 3

Thanks Josh, I really appreciate it.

It would be fantastic to know whether it is safe or not.

0 Likes
Shopify Staff
Shopify Staff
1105 77 144

Hey @ClementBR , 

 

So official answer - there aren't any plans to change this behaviour right now, so for the time being it is safe to use. But at the same time, products and inventory may become more distinct concerns in the future, at which point it wouldn't make sense to fire products/update webhooks. So if you're already working with inventory_levels/update, in terms of future-proofing it may be easier to just stay the course instead of having to switch back at some point in time. 

 

With that being said, nothing in guaranteed here at the moment and you could likely switch to using products/update for a long time without any issue, possibly even forever. There's nothing on the roadmap right now indicating there's a change coming here. 

 

There's just no way to guarantee how safe it'll be, or for how long - so unless you want to have to potentially switch back again at some point it's likely easiest to just continue as-is. 

0 Likes
Shopify Partner
22 0 3

Hi Josh,

 

Thanks for looking into it.

 

I will take action accordingly!

0 Likes