Custom data
Shopify's platform includes data models for fundamental commerce concepts such as products, collections, and orders. However, if you require more complex or specific data models, custom data helps you to extend Shopify's data models and create your own by using the following resources:
- Metafields: define and associate a custom or standard field with different parts of Shopify, such as products, customers, or blogs.
- For example, if you have an apparel store and you want to add care instructions for your products, then you might add a metafield to the product called, "Care instructions". You can then add specific care instructions for one or all of your products.
- Metaobjects: define and create custom data structures with Shopify.
- For example, if you have a beauty and skincare store and you want to capture and display information about your top influencers, then you might build a metaobject called, "Influencer profile". You can then include fields for a headline, image, and description, and then create entries for each influencer. You can display this in your theme or only use it in your admin.
On this page
Types of metafields
You can create the following kinds of metafields:
- Standard: These definitions are automatically configured for you and are designed to be universally compatible across Shopify. Because standard metafield definitions follow standards that are used across all Shopify stores, they're supported by apps, themes, and other parts of your store.
- Custom: These definitions are unique to your store. Use custom definitions for any metafields that don't have standard definitions or if you want to migrate existing metafields to a definition.
- App-owned metafields: These definitions are created using an app from theShopify App Store.
的结构metafields
Metafield definitions have the following parts:
- Name: used to identify the metafield in your Shopify admin, such as
Color
. - Namespace and key: the unique identifier for your metafield. You can use a namespace to group similar metafields together, but each namespace and key must be unique. An example is
custom.color
. - Description(optional): allows you to include descriptive information, such as what values to enter for the metafield
- Type: the type of data that the metafield stores, such as text, file, or URL.
- Validations(optional): the rules for the input of the values, such as character limits, or minimum and maximum values.
Locating your read only app metafields
You can access a list of your app-owned metafields in a specific resource.
Steps:
- In your Shopify admin, go to a resource that has metafields. For example, you can go to a product page.
- In theMetafieldssection, clickShow all.
- ClickMore actions>View read only app metafields.
的结构metaobjects
There are two key components to metaobjects:
- The definition: the group of fields that defines the object’s structure. This is managed inSettings>Custom datain your Shopify admin.
- Entries: the content or data for the metaobject. Entries are created and managed inContent>Metaobjectsin your Shopify admin.
When you create a metaobject, you specify the following information:
- Name: used to identify the metafield in your Shopify admin, such as
Authors
. - Type: the type of data that the metafield stores, such as text, file, or URL.
- Fields: define the type of content you want to display in the metaobject
- Each field has a name, description, type, and validation rules, such as character limits, minimum and maximum values, or preset values.
- For example, you might add a field for text, a field for an image, and a field for color.
Locating your app-controlled metaobjects
You can access your app-controlled metaobjects in your Shopify admin.
Steps:
- In your Shopify admin, go toSettings>Custom data.
- ClickMore actions>View app-controlled metaobjects.