Building a metaobject
You can create metaobjects from two locations in your Shopify admin:
- From Content > Metaobjects
- From Settings > Custom data
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.
Build a new metaobject
- From your Shopify admin, go to Content > Metaobjects or Settings > Custom data.
- Click Add definition.
- In the Name field, enter a name for your defintion. A type for your metaobject is automatically generated, and can be edited prior to saving the metaobject.
- Click Add field and select the content type you want to contain in this metaobject. For example, single line text. Each field has its own set of options and validation rules.
- Configure the field and its validation information:
- Optional: In the Description field, enter a description for your metaobject.
- Choose whether the field will be the entry’s display name by selecting Use this field as display name. The display name is the field that’s used to generate a searchable name in the index view. The display name is automatically set to the first text-based field in your metaobject definition or generated automatically if there is no text field.
- Configure the validation rules for the field, and then click Add.
- Optional: To allow storefront visibility, select Accessible from the Storefront visibility drop-down menu.
- Add additional fields to your metaobject as needed.
- Click Save.
After your metaobject has been saved, you can start creating entries.
Deleting a metaobject
Deleting a metaobject can't be undone. If you delete a metaobject, then all the entries for that metaobject will also be deleted.
- From your Shopify admin, go to Settings > Custom data.
- In the Metaobjects section, click on the metaobject you want to delete.
- Click Delete. A confirmation dialog displays to confirm that you want delete the entry.
- Click Delete to remove the entry.