All things Shopify and commerce
I'm using the Shopify GraphQL Admin API (version 2025-04) and the productSet mutation to update or create products. However, I’ve noticed that if I don’t include existing metafields in the request, they get deleted.
To prevent this, my current approach is:
Fetch existing metafields using a GraphQL query.
Merge them with the new metafields I want to add.
Send everything back in productSet.
The issue is that while I’m fetching the metafields, they might have been updated externally, meaning I could end up sending outdated data and unintentionally overwriting recent changes.
Is there a way to use productSet without affecting existing metafields?
If not, is there an alternative method to update metafields separately without deleting them?
What’s the best practice for ensuring metafields remain intact while updating products?
I have the same problem myself.
It's suprising that you can't use upSert and CustomId without “emptying” the existing metafields.
The solution, which is to retrieve the metafields upstream and send them back, only works if no changes are made to the Shopify data during the time-lapse between retrieval and push.
I doubt we're the only ones to encounter these issues.
Any feedback would be appreciated.
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025