| [ Web Proxy ] |
| Viewing: https://shopify.dev/docs/apps/build/metaobjects | [Back] [Original] |
Metaobjects enable you to define custom data structures with multiple related fields. While metafields add individual custom fields to existing Shopify resources, metaobjects let you create entirely new types of structured data that can be referenced and reused across your store.
You can use metaobjects to, for example, create product size charts with multiple measurements, author profiles with biographical information and contact details, ingredient lists with nutritional data, or warranty information with terms and conditions. This flexibility allows you to model complex data relationships and create rich content structures.
Metaobjects create complex data structures with multiple related fields.
Metaobjects create complex data structures with multiple related fields.
Want to skip ahead? Choose a path based on what you're building:
A metaobject is an instance of structured data with multiple related field values. Unlike metafields that attach single values to existing resources, metaobjects are standalone entities that can be referenced from multiple resources.
Each metaobject contains:
For example, an author metaobject might include a name, biography, email, and profile photo - all stored together as a single reusable entity.
Before creating metaobjects, you create a metaobject definition. Metaobject definitions are schemas that specify the structure, fields, and rules for a metaobject type.
A definition establishes:
$app:author or size_chart). This identifies what kind of metaobject entries you'll create.The relationship is: one definition can have many metaobject instances (entries). For example, one "author" definition can have metaobjects for Jane Smith, John Doe, and other individual authors.
Ownership determines access and control. When creating metaobjects, you choose between two ownership models:
| Ownership Type | Purpose | Type prefix |
|---|---|---|
| App-owned | App-managed entries for features, configurations, and content | Use reserved prefix $app (GraphQL) or app (TOML) |
| Merchant-owned | Merchant-managed content shared across all apps | Use any non-reserved prefix, such as custom |
Additional ownership types:
App-owned metaobjects are custom data structures that are managed by your app. These metaobject entries are used for features requiring multiple related fields, such as configuration panels, content templates, or complex product attributes.
App-ownership is defined using the app reserved type prefix and can be created using your app's shopify.app.toml file.
App-owned metaobject entries are viewable by default in the Shopify admin. Edit access can be configured using the access.admin setting.
App-owned metaobject entries are viewable by default in the Shopify admin. Edit access can be configured using the access.admin setting.
You want to create author profiles with biographical information that can be referenced from blog posts. Because you want your app to own and control the structure, you create an app-owned metaobject.
Create the metaobject definition using your app's shopify.app.toml file. The following creates the definition with app-owned prefix app and type identifier author:
Deploy it with your app:
After you create the metaobject definition, create metaobjects (entries) using the GraphQL Admin API. Use the same type identifier and field keys as your definition:
Merchant-owned metaobjects are custom data structures that can be managed in the Shopify admin or through any installed app. These metaobject entries are ideal for content that should be accessible and editable through the admin interface or multiple apps.
Merchant-ownership is defined by using any non-reserved type and can be created using the GraphQL Admin API.
Merchant-owned metaobjects must be created using GraphQL. TOML configuration only creates app-owned metaobjects.
Merchant-owned metaobjects must be created using GraphQL. TOML configuration only creates app-owned metaobjects.
You want to add size chart information to products. Because this type of structured data should be managed in the Shopify admin and accessible to all apps, you use a merchant-owned metaobject.
Create the metaobject definition using GraphQL. The following creates the definition with type identifier size_chart (no prefix makes it merchant-owned):
Create metaobjects (entries) for specific size charts:
Configure who can read and write your metaobjects using the access settings on your definition.
admin controls permissions for both the Shopify admin and the GraphQL Admin API.
For app-owned metaobjects:
# Merchants can view but not edit (default)
access.admin = "merchant_read"
# Merchants can view and edit
access.admin = "merchant_read_write"access: {
admin: MERCHANT_READ # view only (default)
}
access: {
admin: MERCHANT_READ_WRITE # view and edit
}For merchant-owned metaobjects:
storefront controls permissions for the Storefront API (used by headless and custom storefronts).
Available settings:
# Not accessible on storefront (default)
access.storefront = "none"
# Accessible via Storefront API
access.storefront = "public_read"access: {
storefront: NONE # not accessible (default)
}
access: {
storefront: PUBLIC_READ # accessible via Storefront API
}You can query app-owned metaobjects directly in function input queries. This works across all function types, including discounts, cart transforms, delivery customization, and fulfillment constraints.
The type must use the $app reserved prefix (for example, $app:pricing-config). Merchant-owned types don't work in function input queries.
Each metaobject root costs 1 complexity point, and each field(key:) call costs 3 points. A query with one metaobject and three fields costs 10 points total. The input query budget is 30 points. For the full cost breakdown, refer to input query limits.
| Web Proxy Viewer | New URL | Original Page |