shopifyProductVariant metafields fast sync methods
When I made a change to a variant metafield inside the Shopify admin, I must be able to see it in my Gadget database. I am working on this for like quite some time, but it never works. The only way to sync it is using the sync button in Gadget settings but it takes forever to sync all of the data. I just want to find the changed data and only sync one data. Is there a way to achieve this?
6 Replies
Shopify don't emit webhooks for variant metafield updates so the only way is to perform a sync
That sucks. What if I just fetch this metafield directly from Shopify and bypass Gadget? Is that a good idea?
Shopify should emit webhooks if you're using productVariantsBulkUpdate to update your variant metafields. If you use metafieldSet - I don't believe a webhook is emitted
I'm using productVariantsBulkUpdate but couldn't manage to build a webhook, I can directly fetch from Shopify and fill my data, I will try to go that way.
Still need to work with create() action under shopifyProductVariant though. Hopefully I can handle the webhook there.
Hi Shun/Sauron,
You could utilize webhook filtering check for metafield updates, then if you preform a sync its more efficient
I have a link to the webhook filter docs here: https://docs.gadget.dev/guides/plugins/shopify/shopify-webhooks#applying-a-webhook-filter
I did exactly that, thank you so much.