Disabling model webhooks
So I understand we can disable webhooks . I now need to select the Inventory Item model (as well as Location as this is required for Inventory) for my app just so I'm able to get see if a variants inventory is tracked. I don't really need this to be updated on the go so am I right in thinking I can use
record.disabledWebhooks = { shopifyLocation: true, shopifyInventoryItem: true };
in my shops update action?
Is this also the only way to disable them?
And then when the daily sync runs will these models get the updated data still? Disabling the webhooks will simply stop updating the models on the fly?8 Replies
Hello,
That seems to be correct. Yes, that's the only way to disable webhooks. If you want to handle webhoks but not save data, you shoul dbe using global action webhook handling: https://docs.gadget.dev/guides/plugins/shopify/shopify-webhooks#shopify-webhooks-within-global-actions
Ah that makes sense, thanks for the info Antoine! 🙏
No problem!
Just following up, the docs show putting that
record.disabledWebhooks
in the update action, would it not need putting in the install action too, so the webhooks don't get added during installation?You could definitely add them to the install action if you wish not to have webhooks initially
Okay great, its for a model that I have to sync for another model so won't need to listen to them. Will the model still be udpated from the daily sync that happens though?
No, disabling webhooks also removes the daily sync on that model
You can get around that by running a scheduled sync once a day on the specific model for all shops
Okay gotcha, thats no biggy tbh as I'm not using the data for that model at all. Just simply that it has to be selected
I may even run another action after a day or two of installation to delete that model data as I won't need it