Use Metafields With Sections and Blocks on Product Pages

Estimated reading: 2 minutes

One of the most practical methods of using metafields is adding product-specific content on the product pages. By default on a product page, there’s only a “Description” box where you can add textual content that will be dynamically displayed on a product page. With metafields you can create as many additional content boxes as needed and connect them with any section or block to be displayed dynamically on the product page.

In this guide, we’ll be creating a text metafield and connecting it to a “Collapsible row” block. Let’s go!

Create a text metafield

In your Shopify dashboard go to “Settings->Custom data->Products“. Click “add definition” and give it a unique name. For example: if you want to use this metafield to store your products’ ingredients then you can name it “Product Ingredients”.

Now click “Select type“, then select “Rich text” or “Multi-line text” and save it. This metafield will now be available in the Metafield section of each product ( below Variants ). You can now add unique text content for each of your products.

Display metafield content

Once you created a metafield and added content for at least one of the products you can connect a metafield to a Collapsible row content box or any other section or block ( that has a text/content box ) on the product page.

To do that click the dynamic source icon above the content box, set “current template” to “product“, and then, from the list select the metafield you want to add.

The content will now be pulled dynamically from that metafield and each product will display content you added to its metafield.

In most cases, you’ll want the heading of the collapsible row to be the same for all products, i.e. Product Ingredients. You would then add the heading directly to the heading text field in the block.

However, if you require headings to also change dynamically then you can create a metafield as described above and assign it to the heading text field. In this case, as a “type” of metafield you’d want to select “Single line text” instead of the “Multi-line” or “Rich text”.

Share this Doc

Use Metafields With Sections and Blocks on Product Pages

Or copy link