Displaying metaobjects on your Online Store

If you have anOnline Store 2.0 theme, then you can connect most metaobjects to your theme by using dynamic sources in the theme editor. If you're using a vintage theme, or if you want to add metafield types that your theme doesn't support, then you can编辑你的主题代码or hire a Shopify Partner to help you. Learn more abouthiring a Shopify Partner

You need to ensure the metaobject has Storefronts access. Learn more aboutaccess options

Connect metaobjects to your theme by using the theme editor

If your theme supports metaobjects, then you can choose how to display metaobjects on your online store by using the theme editor. To find out which blocks can connect to metaobjects references in your theme, refer to your theme's documentation orcontact your theme's developer

You can connect metaobjects to your theme by adding sections with blocks that supportdynamic sources.例如,块内Product infosection can be connected to metaobjects.

After you add a section with blocks or a block, you can connect to metaobject references by clicking the connect dynamic source icon next to the block name:

Connect dymamic source icon

Steps:

  1. From your Shopify admin, go to欧宝体育官网入口首页>Themes
  2. Find the theme that you want to edit, and then clickCustomize
  3. In your theme editor, navigate to the part of your template that you want to display your metaobject. For example, your default product template.
  4. Select an existing section that has blocks, or add a new section that has blocks.
  5. Click the block.
  6. Next to the block name, click theConnect dynamic sourceicon.
  7. Select each metaobject reference that you want to display with this block. If it’s a single metaobject reference, then it fills in the settings that the block contains. If it’s a list metaobject reference, then it fills in the settings for the block, and repeats for each instance of the block.

The block automatically maps the metaobjects fields to the settings of the block. In case the fields don't map appropriately, use the connect dynamic source icon on each setting to change them.

Learn more about thecompatability between fields and settings

You can alsouse metaobjects to build and publish landing pages

Repeating block limits

When adding in metaobjects through dynamic sources, you might experience limits to the amount of blocks you can add. This depends on the number of entries in the metaobject that are connected to that resource. For example, the multirow section has a limit of 50 rows. If you have 20 product highlights and connect them in a multirow section, then you can add an additional 30 rows to the section. However, if you have 60 product highlights, then the multirow section only displays the first 50 product highlights.

Depending on the block or section limit, the section has the following limits:

  • If the block type has a limit, then the maximum amount of repeating blocks is equal to the block type limit minus any blocks of the same type added manually.
  • If the section has a limit, then the maximum amount of repeating blocks is equal to the section limit minus any blocks added manually.
  • If the section has no limit, then the maximum number of repeating blocks is equal to 50 minus any blocks added manually.

When you reach a limit and attempt to add another row or block, the limit displays next to添加一行orAdd a blockand greys out the add button to indicate that the limit has been reached.

When you reach the maximum limit

After you reach the limit, additional entries aren't displayed. You can try the following to get all your entries to display:

  • add a different section with a higher block limit which will allow more metaobject entries
  • reduce the number of entries used
  • remove any unnecessary blocks that have been added manually in the editor

Editing your theme code to add metaobjects

You can use your metaobject entries anywhere on your online store using Liquid. You can connect metaobject entries to pages, blogs, home, and collection pages. These entries might be referenced through metafields, but that's dependent on if they need to be dynamic or static.

If you want to编辑你的主题代码to display metaobjects on your online store, then you can useLiquidto reference metafields in your page templates.

Edit your theme code only if you have coding experience. If you need help with editing your theme code, then you can hire a Shopify Partner from the Shopify Partner Directory.

Learn more abouthiring a Shopify Partner

You can also use your metaobjects with Custom Storefronts and Hydrogen.

Learn more about custom data for developers

准备好明星t selling with Shopify?Try it free