The request is pretty simple, but so far every possible solution has failed.
I would like to replicate the behaviour of the Metafield “Disconnect” button on a product via the Admin Graphql API.
After clicking it asks “Disconnecting the metafield “Colour” will convert this into a manual option. Variants and option values will be kept.” and results in everything remaining the same (Variants / Options) just that the connection is removed.
So far I have tried:
1. Updating Product Options by clearing linkedMetaFieldValues
- Deleting all MetaObjects that are attached to the product.optionValues[].linkedMetafieldValues
- Deleting the MetaFields within Product.metafields
Along with a few combinations of both but nothing clears the metafield links.
This is driving me nuts 
1 Like
@Josh_digital just to let you know this is what i’ve already done and it does not work, any attempts to remove the product metafield does nothing, or returns “An Unexpected Error has occured”
@Josephtech this is super annoying to hear, I am only down this path because working with metafields is already not working as expected, now I can’t even programatically clear the metafields 
I’ve already taken on the Hybrid approach you suggested but it’s obviously such an annoyance for customers using the app.
Hi @TheFlyingCoder
please report unsolicited private messages on development posts like this to moderators.
Butlerian Jihad 
tl;dr linkedMetafield field/property is NOT a normal metafield it’s more of a relationship connection (in the technical compiler jock sense but also not really /sigh
) , as linked"Metafield" they can go through shopify’s taxonomy and ~metaobjects. In typical shopify fashion they’ve just poorly named yet another thing causing confusion about what things are and how they work or where to work with them /ugh.
Deleting the metafield NOT working may seem weird and unexpected for metafieldsDelete[1].
Yet linkedMetafield is in EARLY access https://shopify.dev/docs/api/admin-graphql/latest/input-objects/LinkedMetafieldUpdateInput
https://shopify.dev/docs/api/admin/migrate/new-product-model/metafield-linked
Make sure to follow through on the dev forums to address this behavior early before it cements for GA(general access)
Also obligatory: with stuff like this also try to rule out any cache issues, or incorrect references/ids.
A kludge in some situations is to just clone the product; but this is not a viable solution in most uses case because of things like relying on product-ids being the same, or possibly having to make redirects, inventory apps etc etc etc ad nauseum.
[1] assuming your deleting metafields using something like this:
DisconnectProductMetafieldDontWork Mutation sample
mutation DisconnectProductMetafieldDontWork(
$productId: ID!
$namespace: String!
$key: String!
) {
metafieldsDelete(
metafields: [
{
ownerId: $productId
namespace: $namespace
key: $key
}
]
) {
deletedMetafields {
key
namespace
ownerId
}
userErrors {
field
message
}
}
}
vars
{
"productId": "gid://shopify/Product/1234567890",
"namespace": "product_details",
"key": "color"
}
Use the developer forums for actual development issues and feedback, actual chances of engagement from actual shopify-internal devs.
And substantially less bot responses regurgitating your own words back at you (notice how verbose and officious they are but zero docs links, nothing you couldn’t have gotten from asking the dev assistant on the dev docs)
1 Like
@PaulNewton I have got a few messages to give out store links and collaborator codes but there is no way in hell I’d do that
This question isn’t even related to any particular store, it’s for a custom app workflow.
I have had endless issues working with metafields through the Admin API - Even with the Shopify docs directly failing to work when dropped in.
Moving to the Dev forums is a good idea
1 Like