Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
I need to "clear" values on specific MetaFields with Type "single_line_text_field" but only on specific products using the GraphQL API.
As I understand it we cannot send a blank value when running the `mutation metafieldsSet`, as I initially tried this but it won't take it.
If I try `metafieldDelete` mutation I am afraid that it will delete the MetaField everywhere.
I simply need to clear it on a specific set of Products/Product.
Any way to do this, as I am not seeing any way of doing this with the API?
Solved! Go to the solution
This is an accepted solution.
Hi again,
I've looked into this more and it appears the metafieldDelete mutation will clear just the value of the specified metafield, but it won't delete the value of every instance of the metafield.
The metafieldDefinitionDelete mutation will remove the metafield fully from the store.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi Stats_marketing,
Just to confirm, you'd like the same ability that existing in the admin where there's an option to clear a products metafield value, but just via the API?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
I would like this!
This is an accepted solution.
Hi again,
I've looked into this more and it appears the metafieldDelete mutation will clear just the value of the specified metafield, but it won't delete the value of every instance of the metafield.
The metafieldDefinitionDelete mutation will remove the metafield fully from the store.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog