Shopify's platform includes data models for fundamental commerce concepts such as products, collections, and orders out of the box. However, commerce is diverse and often requires more complex or specific data models. The custom data platform enables you to extend Shopify's data models and create your own by using the following resources: - **[Metafields](#about-metafields)**: Define and associate custom fields with Shopify resources such as products. - **[Metaobjects](#about-metaobjects)**: Define and create custom data structures within Shopify. ## About metafields Metafields are a flexible way for your app to add and store additional information about a Shopify resource, such as a product, a collection, [and many other owner types](/docs/api/admin-graphql/latest/enums/MetafieldOwnerType). The additional information stored in metafields can be almost anything related to a resource. Some examples are specifications, size charts, downloadable documents, release dates, images, or part numbers. Merchants and other apps can retrieve and edit the data that's stored in metafields from the Shopify admin. You can also access metafields in themes using Liquid and through the Storefront API. > Tip: > By default, values for metafields aren't accessible to custom storefronts. To enable custom storefronts to display your metafields, you can use the [GraphQL Admin API](/docs/api/admin-graphql/2022-04/objects/metafielddefinition) to give the Storefront API access to metafield definitions. ### How metafields work A metafield includes the following parts: - **Namespace**: A container for a group of metafields. Grouping metafields within a namespace prevents your metafields from conflicting with other metafields with the same key name. - **Key**: The name for the metafield. - **Type**: The [type of data](/docs/apps/build/custom-data/metafields/list-of-data-types) that the metafield stores. - **Value**: The data to store in the metafield. The value is always stored as a string, regardless of the metafield's type. ### Examples In the following GraphQL examples, a merchant that sells clothing uses metafields to store the care instructions for each product. The online store has separate metafields for washing and drying instructions, which are grouped by the `instructions` namespace. Each product can have a different value for each metafield. A metafield set includes all the data for a particular metafield. The following example shows the structure of the `instructions.wash` metafield:

The following example shows the structure of the `instructions.dry` metafield:

### Kinds of metafields You can create different kinds of metafields: - **[Regular metafields](/docs/apps/build/custom-data/metafields/manage-metafields)**: Add and store additional information about a Shopify resource. - **[Private metafields](/docs/apps/build/custom-data/metafields/manage-private-metafields)**: Create metafields that aren't accessible to merchants or other apps. - **[App-data metafields](/docs/apps/build/custom-data/metafields/use-app-data-metafields)**: Create metafields that belong to an app installation and are only accessible by that app. > Note: > If you're helping a merchant to build their store, and you want to set up metafields through the Shopify admin, then refer to the [merchant documentation about metafields](https://help.shopify.com/manual/metafields). ### Metafield definitions [Metafield definitions](/docs/apps/build/custom-data/metafields/definitions) enable you to include data validation for metafields, and enable merchants to add metafield values for resources in the Shopify admin. We also provide standard metafield definitions for common use cases. Using standard definitions means that your app can access information that merchants might have already stored in these metafields and provides interoperability across the Shopify platform. Learn about the [standard metafield definitions](/docs/apps/build/custom-data/metafields/definitions/list-of-standard-definitions) we offer. ### Metafield types Each metafield and metafield definition has a type, which defines the type of information that it can store. The metafield types have built-in validation and [Liquid](/docs/api/liquid/objects/metafield) support. For more information about the supported types, refer to [Metafield types](/docs/apps/build/custom-data/metafields/list-of-data-types). ## About metaobjects Metaobjects are custom data structures that your app can define and create to store your app's information. Similar to [metafields](/docs/apps/build/custom-data/metafields), they can be associated with a Shopify resource such as a product or a collection. However, they can also exist on their own. Metaobjects provide you with a way to create resources that Shopify doesn't offer out of the box. Users can define their own metaobjects or use the ones that your app creates to extend their shop's data model. Metaobjects are also available in themes using Liquid, Storefront API, and Admin API. > Note: > Metaobjects use [metafields](/docs/apps/build/custom-data/metafields) to store their fields. You can learn more about metafields and their supported [types](/docs/apps/build/custom-data/metafields/list-of-data-types). ### Metaobject definitions and entries The following terms are used when describing metaobjects: - **Definition**: A template for which fields and properties you want to declare for your metaobjects. - **Entry**: A metaobject entry created using a definition. ### Metaobject example In the following GraphQL examples, a user wants to create a new resource in Shopify called `Product Highlight`. A product highlight has a title, description and image that displays an interesting fact about a product. The following examples shows the structure of the `Product Highlight` metaobject definition: ```json { "data": { "metaobjectDefinition": { "id": "gid://Shopify/MetaobjectDefinition/1", "type": "$app:product_highlight", "fieldDefinitions": [ { "key": "title", "type": { "name": "single_line_text_field" }, }, { "key": "description", "type": { "name": "multi_line_text_field" }, }, { "key": "image", "type": { "name": "file_reference" }, }, ], } }, } ``` The following example shows a `Product Highlight` metaobject entry: ```json { "data": { "metaobject": { "id": "gid://Shopify/Metaobject/1", "type": "product_highlight", "displayName": "100% Reusable Plastics", "fields": [ { "key": "title", "value": "100% Reusable Plastics", }, { "key": "description", "value": "Rest easy - our glasses are made from 100% reusable materials", }, { "key": "image", "value": "gid://Shopify/File/1", }, ], } } } ``` ## Developer tools and resources Explore the following developer tools and resources for working with metafields and metaobjects: ### Metafields

GraphQL Admin API

Use the GraphQL Admin API to manage metafields, metafield definitions, app-data metafields, and private metafields.

GraphQL Storefront API

Use the GraphQL Storefront API to retrieve metafields.

Liquid

Use Liquid to access the metafield object and output metafield data in themes using metafield filters.

Metafields workshop

Learn how to build and display metafields on your storefront.

### Metaobjects

GraphQL Admin API

Use the GraphQL Admin API to manage metaobjects and metaobject definitions.

GraphQL Storefront API

Use the GraphQL Storefront API to retrieve metaobjects.

Liquid

Use Liquid to access metaobjects and output metaobject data in themes.

## Next steps - Learn how to [own the custom objects and fields](/docs/apps/build/custom-data/reserved-prefixes) that your app defines in Shopify. - Learn about all of the different [types](/docs/apps/build/custom-data/metafields/list-of-data-types) supported by metafields. - Learn how to [manage metafields](/docs/apps/build/custom-data/metafields/manage-metafields) using the GraphQL Admin API. - Use metafields to [link product options to the Shopify taxonomy](/docs/apps/build/graphql/migrate/new-product-model/metafield-linked). - Learn how to [work with metaobjects](/docs/apps/build/custom-data/metaobjects/work-with-metaobjects) using the GraphQL Admin API.