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 definition, you specify the following information:
Name: used to identify the metafield in your Shopify admin, such as
- 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 (required), description, type, and validation rules, such as character limits, minimum and maximum values, or preset values.
- Display name is assigned to a single field name and is used to identify an individual metaobject entry. You can change the field that the display name is assigned to at any time. The display name is automatically assigned to the first text field in a metaobject entry, or autogenerated if there are no text fields in the metaobject definition.
- For example, you might add a field for text and indicate it as a display name, a field for an image, and a field for color.
Options: where the metaobject is available to use.
- Access: By default, Storefronts access is activated for your metaobject. This means that the metaobject can be connected in your theme using dynamic sources. You can deactivate Storefronts access. Learn more about access options.
- Features: You can use the metaobject to create Web pages. Learn more about building web pages with metaobjects.
Create a 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 definition. 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:
- Enter the Name of the entry.
- Optional: In the Description field, enter a description for your metaobject.
- Optional: Select Use this field as display name to use the field as the display name to search in the index.
- Configure the validation rules for the field, and then click Done.
- Add additional fields to your metaobject as needed.
- Optional: To turn off storefront access, deselect Storefronts from the Access section.
- Optional: To allow entries from this metaobject to be published as stand-alone pages, select Web pages under Features.
- Click Save.
After your metaobject has been saved, you can start creating entries.
Delete 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 the metaobject that you want to delete.
- Click Delete. A confirmation dialog displays to confirm that you want delete the definition.
- Click Delete to remove the definition.