Metaobjects tutorial

Metaobjects help you add and store additional structured information for your store. Metaobjects can be used in your Shopify admin for data storage or to create reusable, structured content that's displayed in your online store. Here are some examples of metaobjects and where you can use them:

  • Add fabric types to your products and display them on your product pages in your online store.
  • Create FAQs for your products and display them on your product pages in your online store.
  • Create ambassador or influencer profiles with images and text and then display them on a page in your online store.

You can add metaobjects to your products, collections, customers, orders, and other parts of your store, directly from your Shopify admin.

If you have anOnline Store 2.0 theme, then you can connect your metaobject to your theme by creating ametaobject reference with metafields.If you're using vintage themes, or if you want to add metafield types that your theme doesn't support, then you canedit your theme codeor hire a Shopify Expert to help you. Learn more about hiringShopify Experts

Product highlights tutorial

In this tutorial, you learn how create a metaobject for product highlights and display them on your online store.

What you'll learn

After you've finished this tutorial, you'll have accomplished the following:

  • Created a metaobject for product highlights
  • Created several entries for product highlights using the metaobject you created
  • Created a metafield definition that references the metaobject
  • Connected your entries to specific products
  • Published your metaobject entries

Step one: metaobject

  1. From your Shopify admin, go toSettings>Custom data
  2. UnderMetaobjects, clickAdd definition
  3. Name your metaobject definitionProduct Highlights
  4. ClickAdd fieldand select the type of content you want to display in this metaobject. Fields define the content displayed in your metaobject, and each field has its own set of options and validations.
    • For this tutorial, we're building a product highlights metaobject that will display an image, the name of the product, a caption, and a description. To add the first field, selectFile
  5. Configure the type and validations. Name the fieldImage, and enter a brief description.
  6. UnderAccess,Storefrontis automatically selected. Keep this option selected as it allows the content to be accessed and displayed by your store.
  7. Add the image field to your metaobject. ChooseAdd field>File
    • Name this fieldImage
    • UncheckVideosto limit this metaobject to only display images.
    • Enter a description.
    • ClickAddwhen done.
  8. Add the heading field to your metaobject. This time, chooseAdd field>Single line textas the field type. Do the following:
    • Name this fieldHeading
    • CheckUse this field as display nameto use this field as the entry name in the index.
    • Enter a description.
    • ClickAddwhen done.
  9. Add the caption field to your metaobject. ClickAdd field>Single line text.Do the following:
    • Name this fieldCaption
    • Enter a description.
    • ClickAddwhen done.
  10. Add the description field to your metaobject. ClickAdd field>Multi-line text.Do the following:
    • Name this fieldDescription
    • Enter a description.
    • ClickAddwhen done.
  11. Saveyour new metaobject definition.

After your metaobject definition has been saved, you can startcreating entries

Step two: Create entries

  1. From your Shopify admin, clickContent
  2. ClickAdd entry.Choose theProduct Highlightsmetaobject definition to base the new entry on.
  3. Complete the fields for your entry:
    • ClickSelect imageand choose or upload an image for this product highlight.
    • Add aTitleand aDescription
  4. The status is automatically set toActive.If you are not ready to use the entries, then you can change the status toDraft
  5. ClickSave

Your entry has a generatedHandle, which is a unique identifier specific to a single content entry. After you start connecting your entries to areas of your store, editing the handle isn't recommended. Learn more aboutthe impact of changing an entry handle after you have been using it in your store

Repeat the steps above to create three more entries based on the product highlights metaobject definition.

After you have your metaobject definition and entries saved, you can create ametafield definition that references the metaobject

Step three: Create a metafield definition that references the metaobject

  1. From your Shopify admin, go toSettings>Custom data
  2. In theMetafieldssection, clickProducts
  3. ClickAdd definition.Enter a unique name and description, and then clickSelect content type
  4. ClickSelect typeand thenMetaobject
  5. In theReferencesection, select the metaobject definition you want to reference. ChooseProduct Highlights.This limits the metafield product definition to only show entries related to the product highlights metaobject.
  6. Define whether this definition can display one entry, or a list of them. For this example, choose theList of entriesoption.
  7. In theAccesssection, select theStorefrontsoption.
  8. ClickSave

Next, you'llconnectthe entries to the products you want to display them on.

Step four: Connect your products to the entries

  1. From your Shopify admin, go toProducts

  2. Select a product that you want to display product highlights on.

  3. Scroll down toMetafields.In this example, we want to display some of, but not all, the product highlights entries that we've created. Click the entry field next to yourProduct Highlightsmetafield。如果产品亮点并不在元fields list, then clickShow all

  4. ClickSelect entries.在这个步骤中,你选择条目want to display on this particular product. Choose two of your product highlights.

  5. Return to your products page. Select a different product, and follow the previous step to assign two different product highlights entries to the product.

Next you willpublish your metaobjects on your online store

Step five: Publishing your entries to your online store

Now that you've connected your entries to your products, it's time to display your entries on your store. This step uses the theme editor to select the blocks and sections where your metaobject entries will be linked.

After you add a section or block, you can select a metafield by clicking the connect dynamic source icon:

Connect dymamic source icon

  1. From your Shopify admin, go to欧宝体育官网入口首页>Themes
  2. Find the theme you want to edit, and then clickCustomize
  3. Use the drop-down menu at the top of your screen to selectProducts>Default product.This loads the default product template in the theme editor.
  4. ClickAdd sectionin the left sidebar and chooseMultirowas the new section type.
  5. Click the first row of theMultirowsection.
    • The settings for the first block display in the right sidebar. In your column block, you can manually select an image, insert a heading, add a caption, and add a description. You can also click each individual data source icon, and link the block setting to your desired entry.
  6. Click theConnect dynamic sourcenext to the block name to selectProduct Highlights.Your theme editor populates your new multirow block with your product highlights entries.
  7. Configure remaining blocks in theMultirowsection, or remove the unused blocks.
  8. ClickSaveto publish your product highlights entries.

Your entries only display on the products they're connected to and the section won't publish if a product isn't connected to entries. That means you can set up a single product template that will work for all your products.

Ready to start selling with Shopify?Try it free