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 influence. You can display this in your theme or only use it in your admin.
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-data metafields: These definitions are created using an app from the Shopify App Store.
Structure of metafields
Metafield definitions have the following parts:
- name, which is used to identify the metafield in your Shopify admin
- key, for example, to group metafields for specific parts of your store
- description (optional), such as information about what values to enter for the metafield
- type, such as text, file, or URL
- validations (optional), 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.
- In your Shopify admin, go to a resource that has metafields. For example, you can go to a product page.
- In the Metafields section, click Show all.
- Click More actions > View read only app metafields.
Structure of metaobjects
There are two key components to metaobjects:
- The definition: the group of fields that defines the object’s structure. This is managed in Settings > Custom data in your Shopify admin.
- Entries: the content or data for the metaobject. Entries are created and managed in Content > Metaobjects in your Shopify admin.
When you create a metaobject, you specify the following information:
- the name, which is used to identify the metaobject in your Shopify admin
- the type, which is used to identify the metaobject in the APIs
- the fields, which 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.
- In your Shopify admin, go to Settings > Custom data.
- Click More actions > View app-controlled metaobjects.