How to find the ID of the App.Metafiled?
I am looking on how to delete app.metafield but this require the ID.
The mutation which suppose to allow find id does not have support for OwnerType APP
{
metafieldDefinitions(first:2, ownerType: APP) {
edges {
node {
id,
key,
namespace
}
}
}
}
Argument ‘ownerType’ on Field ‘metafieldDefinitions’ has an invalid value (APP)
Hi @lokki54
You’re looking for the ID of a metafield correct? The query you’re trying would give you the ID for a metafield definition rather than a metafield, and the APP owner type does not currently support metafield definitions so that’s why you’re getting that error.
You have a couple chances to grab the metafield GID depending on whether need to get it from a newly created metafield or one that’s already existing.
To grab a newly created one then you can just query on the response of the mutation that creates it:
mutation {
metafieldsSet(metafields: [{namespace: "custom", key: "test", type: "json", value: "[]"}]) {
metafields {
id
namespace
key
}
}
}
If you’ve already created this metafield then you can query it by namespace/key and fetch the ID as well:
query {
product(id: "gid://shopify/Product/12312") {
metafield(namespace: "custom", key: "test") {
id
}
}
}