When I try to create a metafield definition with the type set to “money,” it always reports that the key already exists. I’ve checked the list of metafield definitions within that namespace ($app:namespace), but the key I want to create doesn’t actually exist, and our namespace format is $app:namespace
Thanks in advance! this is preventing some of our merchants from performing standard customer support
I tried creating a definition with a namespace without $e.g:test_namespace, but it didn’t work, and it returned the error: Setting access controls on a definition under this namespace is not permitted.
The issue you’re experiencing may be related to how the $app: namespace is resolved by Shopify. Specifically, the $app: prefix is translated into a fully resolved reserved namespace by the API layer, with the format:
app–{your-app-id}–{some-namespace}
Here’s a breakdown of how this works:
app: This prefix signifies that the namespace belongs to an app.
your-app-id: This is the API client ID associated with your app.
some-namespace: This is the custom namespace you’ve chosen, e.g., namespace in your case.
For example, if your API client ID is 123456, your resolved namespace will look like this:
app--123456--namespace
Key Points:
When creating or updating metafields via the API, always use $app:namespace in your requests. Even if the namespace appears valid (e.g., $app:namespace), the error could occur if there’s already a conflicting key under the fully resolved namespace (app–{your-app-id}–namespace).
Next Steps:
Confirm that no conflicting metafield definition with the key shop_currency exists under the resolved namespace (app–{your-app-id}–namespace).
Use the metafieldDefinitions query to retrieve all definitions in this namespace for verification.
If no conflict exists, retry the creation request with the same parameters.
I have checked the metafield definitions with the fully resolved namespace (e.g., app–{your-app-id}–namespace) and also with $app:namespace, but the key I want to create does not appear. However, when I perform the mutation, I still encounter the error: Definition type does not support migration of existing metafields. Could it be due to the type: money? Please verify this for me.