Shopify PRODUCTS_UPDATE webhook doesn't track variants metafield changes

Shopify PRODUCTS_UPDATE webhook doesn't track variants metafield changes

mmarienko
Shopify Partner
23 0 13

Dear @Shopify Team,


I discovered a bug regarding the PRODUCTS_UPDATE topic in webhooks. It appears that variant metafield updates are not included. Could you provide information on when this issue will be resolved, or clarify why this limitation exists? I already saw a few articles about that without answers:

 

Would you be able to assist us?

FYI: @_JB 

export default {
  PRODUCTS_UPDATE: {
    deliveryMethod: DeliveryMethod.Http,
    callbackUrl: "/api/webhooks",
    includeFields: [
      "variants"
    ],
    metafieldNamespaces: [
      "custom"
    ],
    callback: async (topic, shop, body, webhookId) => {
      console.log('--- Product update ---');
      const payload = JSON.parse(body);
      console.log(payload.variants);
      console.log('--- /Product update ---');
    },
  },
};

 

Regards, Max Marienko - Shopify Expert
Replies 3 (3)

ShopifyDevSup
Shopify Staff
1453 238 508

Hey @mmarienko, thanks for getting in touch, this is a great question. I have been able to look into a similar question on this a little while back (a bit more context here) and my understanding is that the limitation is intentional. That said, I do understand where you're coming from here - it would make sense to include the relevant metafield data attached to the product in the webhook payload here. 

I can't guarantee anything specifically, but I will raise this internally and respond back here in this thread if I am able to share anything further on this. If you're able to provide a use case and any additional information you'd like to share, I'd be happy to pass that along too so we can inform any possible next steps. 

Again, I'm unable to guarantee anything on my end, but I'm happy to take a deeper look and see if I can share anything further on my end. 

I'll keep an eye on this thread, hope this helps and hope to hear from you soon. 

 

Al | Shopify Developer Support

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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

Nourishe
Shopify Partner
12 0 8

I wanted to comment here to elaborate on a few use cases for this. We have implemented metaobjects using the exact use case that Shopify used to introduce metaobject: ingredients. We then added a metafield on the products referencing the ingredient metaobjects. 

 

There are a handful of limitations with this (since the reference is not a 2-way one, and also because metafields cannot be used to make an automated collection). I have already outlined the problem with these limitations here: https://community.shopify.com/c/technical-q-a/paginate-a-matching-set-of-products-like-a-collection-...

 

So, in order to automate this reference to be a 2 way reference (to avoid doubling the workload), there needs to be a way to see those metafield ingredient changes made to the products via webhook, and then add those references to the metaobject automatically.

 

In addition, this same webhook could be used to add tags to the products when this metafield is adjusted, since there is not currently a way to paginate over the products containing specific metafield references, and we would instead need to use tags to create automated collections in the absence of a way to make autocollections using metafields.

Organic & Vegan Skincare
Nourishe.co
pepsimax2k
New Member
7 0 0

Would also like to see this "fixed". Use case? Doing anything based on data specific to a given variant that doesn't have a default field and therefore needs a metafield.

 

Eg. I want to enter some some info specific to a variant ("they're X persons favourite") and trigger an action when the field is populated.

Or, "this is a bundle of item X" which then triggers "add the bundle sku to a field in item X".

 

Both necessitate using the variant's metafield and not the product's. But currently no way to get a webhook trigger from them.