Metafields Store Custom Data in Shopify
If you sell products on Shopify, consider using metafields to enhance the customer experience and potentially increase orders.
Not every new Shopify feature is worth getting overly excited about. Metafields and their close relative, metaobjects, are distinct.Â
They are both easy to set up and can save significant time when updating your Shopify online store.
What Are Metafields?
Suppose you want to add products to your Shopify online store. Each product needs to include a detailed list of ingredients. Previously, you had to add this information to the product description, which worked fine. However, you couldn't display the ingredients separately from the product description, such as in a collapsible tab.
This is where Shopify's metafields come in handy.
With metafields, you can add custom fields to your products, variants, collections, customers, orders, blog posts, and other areas of your Shopify store. The limit is 250 for each object, independent of your Shopify plan.
You can add these metafields to your online store using your Shopify Admin Panel.
Here is the best thing: If you are using a Shopify 2.0 Theme, you can easily connect these metafields to your theme using the Theme Editor without having to change your theme code. That's huge news because everyone can use this feature in their theme.
How to Add a Metafield
Adding a metafield to your Shopify online store is straightforward.
Go to Shopify Admin > Content > Metaobjects.
Click Manage Definitions.
Under Metafield Definitions, select an object. For example, choose Products to add a metafield to the product object or Customers to add a metafield to the customer object.
Click Assigned to all Products.
Click Add Definition.
Enter a Name and a Description.
Select a Metafield Content Type. A content type defines the information a metafield captures. For example, if you want to enter single-line text, select the Single-Line Text content type. You can write single-line text but not multi-line text. Before choosing a content type, consider what kind of data you want to store.
How to Change the Order Metafields Are Displayed
Sometimes, you want to enter the metafields in a particular order.
Go to Shopify Admin > Content > Metaobjects.
Click Manage Definitions.
Under Metafield Definitions, select an object. For example, choose Products to change the order of the metafields belonging to the product object.
Click Assigned to all Products.
Change the order of the metafields by moving the icon with the six dots on the left up or down.
How to Connect a Metafield to a Theme Using the Theme Editor
If your online store is based on a Shopify 2.0 theme, you can use the built-in Theme Editor to connect a metafield to your theme in just a few easy steps. There is no programming required.
Go to Shopify Admin > Online Store.
Under your current theme, click Customize.
Select the page template at the top of the Theme Editor, for example, Home Page or Products > Default Product.
Add a new section or add a new block within an existing section.
Choose the section or block type, such as Collapsible Tab.
Click the Collapsible Tab you just created.
Under content, click the icon Connect Dynamic Source.
Click Products from the menu to connect a metafield you added to the product object.
Select a metafield from the list.
Save your template.
Important Tip:
To connect a metafield to a theme element, the metafield content type has to match the theme element content type. Otherwise, the metafield wouldn't show up in the list. For example, connecting a single-line text heading to a multi-line text metafield wouldn't work. A single-line text heading requires a single-line text metafield.