We provide a Shopify App to enable Shopify merchants to sell extended warranties for their products. Part of the process in providing this service to merchants is to ensure we have an accurate representation of the variants in a merchant's Shopify store. As part of our integration, we add a webhook for the `product/update` topic that POSTs to our endpoint to see if there are price changes for the variant we need to account for when we offer the extended warranty.
However, we noticed that there is an influx of webhook `product/update` requests coming into our system when we do this. After investigating, it seems that every time an order is made on a product that is inventory-tracked, the webhook is called, since Shopify seems to consider this a "product" update.
Therefore, I have the following questions:
1. Is there some way we can only receive a webhook request from Shopify when just the product's fields are changed (such as description, price, title, etc.), and not inventory?
2. Is there a way to tell in the 'product/update' webhook request body what field changed, so we can decide whether or not this webhook is actionable on our part? Preferably the solution would not involve managing our own version of the merchant's Shopify product catalog and querying against our database every time to compare fields and see what changed.
3. If the answers to questions 1. and 2. are no, is there anything on the developer roadmap to change the behavior of these webhooks to conform to the requests I spelled out here?
Solved! Go to the solution
This is an accepted solution.
Hello @pmooney-extend, to answer your questions:
Sadly, no. However, there are more topics you can listen to that are inventory-specific if that helps, such as 'inventory_levels/update' or 'inventory_items/update'
My goal is to filter the events due to inventory update and keep only others, cause I have hundreds of update events that I don't need and that give me a lot of unusefull traffic that send my system in crysis. Can you give some advice to solve?
The variants seem to have `old_inventory_quantity` alongside with `inventory_quantity`.
If you update a product in Shopify Admin, and Product Update webhook gets fired, and all the quantities are the same - could you safely assume that you updated something outside of quantity?
If an order is placed, it seems safe to assume the only thing that's going to change is an inventory.
If so, a very simple serverless function could solve this in ~10 LOC
We noticed this too @cYberSport91 , but when testing this same concept in our lambda, for whatever reason, Shopify was ALWAYS returning the same value for old_inventory_quantity and inventory_quantity