Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hi,
After subscribing to the collections/update webhook, Shopify sends the webhook when I update any metafield that is related to the collection. But the metafields property does not exist in the request body.(Rest Admin API)
{ "webhook": { "topic": "collections/update", "address": "<webhook_deliver_url>", "format": "json", "fields": [ "id", "metafields" ], "metafield_namespaces": ["custom"] } }
I also tested the products/update webhook with subscribing below payload and it works as I expected.
{ "webhook": { "topic": "products/update", "address": "<webhook_deliver_url>", "format": "json", "fields": [ "id", "metafields" ], "metafield_namespaces": ["custom"] } }
Similar post: https://community.shopify.com/c/graphql-basics-and/collection-metafields-not-returned-on-webhook-eve...
Is there any way to include collection metafields to webhook payload?
Thank you in advance.
Hi Tayfun,
I'd checked with the product team on this and it does seem that unlike the products resource, collection metafields are not accessible via a webhooks payload. Instead you could make a separate API call to the Admin API to access a collection's metafield.
I do understand that this inconsistency is unexpected though, so I'll connect with the relevant product team to include this as a feature request and we'll update the docs to describe this current behaviour.
Hope this helps,
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog