Update product's metafield on product update webhook

Update product's metafield on product update webhook

lynth
Shopify Partner
140 6 16

Hi, I’d like to implement the following logic:
Webhook for product updates triggers adding a value to the metafield of the updated product, using data from the JSON object provided by the webhook. This should happen on every product update.

I want to track the price history of a product. Can this be achieved within Shopify, or am I forced to create an app with an external endpoint and then redirect the functionality back to Shopify to modify the metafield? I’ve seen that Shopify has a native app called Flow, and it seems this could work there, but there’s no trigger for “Product update,” only for “Product update status,” which doesn’t help me.

I was also considering creating an app using Shopify app init. Still, I’m not quite sure which framework it should be based on, how to capture the webhook, and how to return the action to a database using a mutation query to modify the metafield.

If my tips are useful, just mark it as the solution. Cheers!
Feeling grateful? Buy me a coffee!
Replies 0 (0)