Building a metaobject
You can create metaobjects from two locations in your Shopify admin:
- FromContent>Metaobjects
- FromSettings>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 automatically generated and editable, and 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.
On this page
Build a new metaobject
Steps:
- From your Shopify admin, go toContent>MetaobjectsorSettings>Custom data.
- Click添加definition.
- In theNamefield, enter a name for your defintion. A type for your metaobject is automatically generated, and can be edited prior to saving the metaobject.
- Click添加fieldand 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 theDescriptionfield, enter a description for your metaobject.
- Choose whether the field will be the entry’s display name by selectingUse 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添加.
- Optional: To turn off storefront access, deselectStorefrontsfrom theAccesssection.
- Optional: To allow entries from this metaobject to be published as stand-alone pages, selectWeb pagesunderFeatures.
- 添加additional fields to your metaobject as needed.
- ClickSave.
After your metaobject has been saved, you can startcreating 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.
Steps:
- From your Shopify admin, go toSettings>Custom data.
- In theMetaobjects部分,点击你的元对象want to delete.
- Click删除. A confirmation dialog displays to confirm that you want delete the definition.
- Click删除to remove the definition.