Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Collection metafields not included collections/update webhook payload

Collection metafields not included collections/update webhook payload

tayfun_akguc
Visitor
1 0 0

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.

Reply 1 (1)

Liam
Community Manager
3108 344 904

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