Closed johndwells closed 2 months ago
Sorry for the delay.
Is this where the problem lies? Will the plugin not support additional webhook handlers?
Yes correct. Your plugin/module will need to register the webhooks itself (and make sure the API key has permissions to the resources you are listening to), and create the webhooks in your plugin/module.
You can see how to do this this here: https://github.com/craftcms/shopify/blob/develop/src/controllers/WebhooksController.php#L84-L109
Our webhook creation code is only for the features we support (and advise to make a limited API key for), so we require other plugins/modules to manually register manually with Shopify.
Thanks.
Description
We need to synchronise Shopify collection information to Craft categories. In our custom module, we have registered a custom handler:
And then in
CollectionHandler
, we match for the topics we are interested in, and then call our service layer accordingly. It is written just like the plugin's own Product handler: https://github.com/craftcms/shopify/blob/develop/src/handlers/Product.phpFinally in Shopify, we have created Collection-specific webhooks, using the same Callback URL as the rest, e.g.
https://domain.com/shopify/webhook/handle
I had hoped this would suffice - however, Collections do not seem to be synchronising. I'm trying to figure out why.
In the Shopify plugin's Webhooks section, for "Webhook Management", the docs say that we have to create these on a per-environment basis. This only appears to include the plugin's supported topics -
products/create
,products/update
,products/delete
, andinventory_levels/update
. It doesn't give me any way to create others.Is this where the problem lies? Will the plugin not support additional webhook handlers?
Additional info