Does the product/update webhook fire when a product/variant metafield is updated?

Does the product/update webhook fire when a product/variant metafield is updated?

Cormick_Browne
Tourist
9 0 4

Does the product/update webhook fire when a product/variant metafield is updated?

Replies 8 (8)

Nathen_Bowes
Shopify Staff
12 0 1

Hey Cormick,

It absolutely does. If you create a webhook in your admin as a product/create and follow the Product Variant API documentation for metafields you will receive information when you update a metafield on a product. 

https://docs.shopify.com/api/product_variant#update

Take care,

Nathen B

To learn more visit the Shopify Help Center or the Community Blog.

Alex92
Shopify Partner
10 0 0

Hey Nathen,

I am using the metafields2 app and I am not seeing the webhook fire when I save the metafields.  Any idea why this is happening? Here's a screenshot of my webhooks: http://cl.ly/image/0V190A2y3h3F

Thanks,

Alex

Alex92
Shopify Partner
10 0 0

Hi Nathen,

I am not seeing the webhook being fired when I save a metafield in metafields2.  Here are the webhooks I have configured: http://cl.ly/image/0V190A2y3h3F. ; Any idea why this might not work?

Thanks,

Alex

JAS_Technology
Shopify Partner
86 0 62

I just gave this a try and I am not seeing the product/create or product/update webhook firing. I am seeing the updated_at timestamp on the product change properly. I am using webhooks registered in the notifications area and the metafields2 app. Does this maybe only work with webhooks registered with private or public apps?

Happy to hear about your crazy ideas.

Jerska
Shopify Partner
4 0 0

Bump. As Jonathan, my webhooks aren't triggered on a product metafield creation or update.

Could someone confirm that they are supposed to trigger and that they actually do?

Software Engineer @Algolia

Jerska
Shopify Partner
4 0 0

I can confirm the product/update webhook doesn't trigger when adding a metafield.

> ShopifyAPI::Product.first.add_metafield(ShopifyAPI::Metafield.new(namespace: 'color', key: 'color1', value: 'blue', value_type: 'string'))
...
I, [2015-06-25T22:52:30.883464 #18018]  INFO -- : POST https://myshop.myshopify.com:443/admin/products/442905229/metafields.json
I, [2015-06-25T22:52:30.883626 #18018]  INFO -- : --> 201 Created 252 (596.7ms)
...

And here is my webhook, which is as you can see alive and working.

> ShopifyAPI::Webhook.get(23055105)
=> {"address"=>"https://myshop.ngrok.com/webhooks/products/update",
 "created_at"=>"2015-06-02T22:50:59+02:00",
 "fields"=>[],
 "format"=>"json",
 "id"=>23055105,
 "metafield_namespaces"=>[],
 "topic"=>"products/update",
 "updated_at"=>"2015-06-02T22:50:59+02:00"}

Furthermore, this webhook triggers fine on a normal update of a product.

I believe this is a regression because of the answer of Nathen. It would be great if the dev team could have a look.

Software Engineer @Algolia

Jerska
Shopify Partner
4 0 0

Bump.

Software Engineer @Algolia
Steve_Drozdowsk
Shopify Partner
4 0 2

I ran into this same problem.  From what I found, looks like the Metafields2 App is making POST requests to the /variants/#id/metafields.json endpoint.  And the product update webhook doesn't fire when using that endpoint.

 

When I make a POST request to this endpoint, the webhook doesn't fire: https://knack-production.myshopify.com/admin/api/2020-01/variants/<variant-id>/metafields.json

 

{
     "metafield": {
        "key": "test",
        "value": "test",
        "value_type": "string",
        "namespace": "global"
     }
}

Here's the API reference for this endpoint: https://shopify.dev/docs/admin-api/rest/reference/metafield?api[version]=2020-01.  There is reference to updating a variant metafields in that documentation

 

But when I make a PUT request to this endpoint, the webhook does fire: https://knack-production.myshopify.com/admin/api/2020-01/variants/<variant-id>.json

 

{
	"variant": {
	    "id": <id>,
	    "metafields": [
	      {
	        "key": "test",
	        "value": "test123",
	        "value_type": "string",
	        "namespace": "global"
	      }
	    ]
	  }
}