I need to track an event when a merchant was changed variant metafield to check the value and push something to another host.
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 ---');
},
},
};
I’m trying to create the webhook for it. But the PRODUCTS_UPDATE topic works for product internal changes (title/description/options/product metafields and etc.), and even for variant title/description/price/etc changes but not for the variants metafields. Only for the first their call, I suppose when the metafield is created.
Does someone know how to expand the webhook to track variant metafield or you know another way?