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?
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!
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.
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.
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.
Any update here? For headless sites that only interact with Shopify's API, you want that "product updated" webhook to trigger new site builds. But you wouldn't want to re-build/deploy your site every time there is an order (decrementing inventory). So for now, I'm unable to use Shopify product webhooks and we have to manually trigger builds after updating products.
Is there an ETA on either providing a new product updated webhook that excludes inventory changes, or a new version of the current webhook that omits inventory changes?
Same problem for me. Our website is getting rebuilt every time someone places an order. This is super inefficient and expensive for hundred+ orders/day, none of which should trigger rebuilding the site...