Ownership
Metafields and metaobjects can be owned by merchants or apps. Merchant owned metafields and metaobjects are open to merchants and developers, which means there are no restrictions on who can read, write, or modify them. However, you can use reserved namespaces to gain control over your application's data.
Reserved prefixes
Anchor link to section titled "Reserved prefixes"There is a reserved prefix your app can prepend to metafield namespaces and metaobject types to take ownership of them. Using a reserved namespace ensures that your app exclusively controls all structure, data, permissions, and optional features.
Create metafield definitions with reserved namespaces
Anchor link to section titled "Create metafield definitions with reserved namespaces"To establish metafield definitions within a reserved namespace, prefix the namespace with $app
. The API will automatically convert this to a fully qualified reserved namespace like app--{your-app-id}[--{optional-namespace}]
:
app
: Indicates that this is a reserved namespace for an app.{your-app-id}
: Your app's unique API client ID.{optional-namespace}
: An optional namespace of your choosing.
For example, if your app's API client ID is 123456
, you can create both:
$app
→app--123456
$app:influencer
→app--123456--influencer
Example:
The following example creates a product metafield definition under a reserved namespace:
Create metaobject definitions with reserved types
Anchor link to section titled "Create metaobject definitions with reserved types"Similar to metafields, you can create metaobject definitions owned by your app by using the reserved prefix syntax for the metaobject type.
The following example creates a product highlight metaobject definition under a reserved namespace, while overriding the default permissions to grant the merchant read and write access:
- Learn about defining metafields to create custom fields.
- Learn about managing metaobjects to create custom objects.
- Learn about permissions for your definitions.