I can update an order with a metafield value that does not have a definition. If I then try to create an app definition using my app reserved namespace and key Shopify will return user errors that it already exists.
mutation metafieldDefinitionCreate($definition: MetafieldDefinitionInput!) {
metafieldDefinitionCreate(definition: $definition) {
createdDefinition {
id
}
userErrors {
code
field
message
}
}
}
"userErrors": [
{
"code": "UNSTRUCTURED_ALREADY_EXISTS",
"field": [
"definition"
],
"message": "Namespace and key is already in use for a set of your metafields."
}
]
However, the metafield will remain invisible to the merchant and the app owner when running this query.
query metafieldDefinitionsget {
metafieldDefinitions(first: 100, ownerType: ORDER) {
edges {
node {
id
pinnedPosition
name
namespace
ownerType
key
}
}
}
}
App developers need a way to create metafield definitions for the metafield values their app set.
The bug was previously surfaced six month ago here.
https://community.shopify.com/c/metafields-and-custom-data/trying-to-create-a-metafield-definition-for-a-namespace-key/m-p/1439497