Understand Shopify Metafields and Metaobjects

By Bhavesha | Jul 31, 2023 | 7 min reads

Shopify Metafields and Metaobjects are powerful features that allow you to add custom data to your store’s products, variants, customers, orders, and other entities. They enable you to extend the default functionality of Shopify and store additional information beyond what is provided by the standard attributes.

Here’s how to add metafields and metaobjects to your Shopify store without coding-

  • A better understanding of what a metafield is and what a metaobject is.
  • Use meta fields to create product detail pages with additional parameters 
  • Using metaobjects, you can display dynamic content on product/collection pages.

The following details must be understood- 

Metafields are key-value pairs used to store custom data associated with Shopify entities. These entities can be products, product variants, collections, customers, orders, and more. Metafields consist of the following components-

  • Namespace 
  • Key
  • value

There is a disadvantage in that you have to enter the value for each separately. And if you want to update it, you must also update each individually. The use case is displaying additional information on your product detail pages, such as dimensions, materials, or delivery dates.

Metaobjects are used to associate metafields with different entities. For example, if you want to associate custom data with a specific product, you would create a meta object for that product.

A metaobject consists of the following elements-

  • Metafield Namespace
  • Metafield Key
  • Metafield value

Note: Metaobjects help organize and structure custom data for your Shopify entities. They can be retrieved, updated, and created through the Shopify API or other methods.

Adding additional parameters to product detail pages can be achieved using meta fields

For example, we sell bags and each bag’s product has different parameters (not variants) so bags have unique 1. Stuff  2. Decorative and which elements that you want to display on the product detail page. 

1. How to add a metafield to your store

  • Navigate to your store’s Admin > Settings > Custom data
  • Select products and click on add definition in the meta fields section.
  • Select the meta field name (i.e. Stuff) and select type (i.e. single line text). 
how-to-add-a-metafield-to-your-store

2. Meta fields for products

You have defined metafields, so let’s add them to your products –

  • Navigate to your store’s Admin > Products > Select a product for which you want to define those metafields.
  • On the product page > find meta fields
  • Please enter the relevant information for this particular product and click on “Save”.
meta-fields-for-products

    Product-specific metafields

3. Metafields displayed on product detail pages

We will display the metafield information on the PDP now.

  • Navigate to your store’s Admin > Online Store > Themes >Customize
  • Top-middle template menu > Products > Default product
  • Add a new block to the Product page, i.e Text
  • Add metafields content by clicking on the database(“burger”) icon.
metafields-displayed-on-product-detail-pages

Metafield display on the storefront

Adding to display dynamic content on product/collection pages using metaobjects 

A metaobject is a more complex one that adds dynamic content to your store that you can edit or update from a single location. For just example:  you would like to feature a different designer on each collection page, not just a name but a full section including name, description, colors, images, etc.

1. How to add metaobjects to your store

  • Navigate to your store’s Admin > Settings > Custom data
  • Click on add definition under metaobjects
  • Enter the metaobject name (i.e. Decorative) and add metafields.

In our example, each designer has a Name (single-line text), Details (rich text), and images (file).

how-to-add-metaobjects-to-your-store

2. Add metaobjects entry

  • Navigate to your store’s Admin > Settings > Custom data
  • Select the existing metaobject in the Metaobjects section
  • Add a new entry by clicking More Actions in the top-right corner.
  • Save and continue with another new entry (if there are more).
  • Complete all required inputs, save, and continue with another entry (if there are more).
add-metaobjects-entry

Adding metaobject entries

3. Prepare Collection/Product metafield

  • Navigate to your store’s Admin > Settings > Custom data
  • Metafields sections > select collections > add definition 
  • Metafield name (i.e. Decorative), select type (i.e. Metaobjects), reference, which should be an existing metaobject, and save.
prepare-collection-product-metafield

Creating metafield as a reference for metaobject

4. Add metaobject to collections

  • Navigate to your store’s Admin> Collections> Select a product for which you want to define those metafields.
  • In your admin, scroll down to see available metafields on the collection page.
  • Click on the blank input next to your metafield, select one of the existing entries, and click on Save
add-metaobject-to-collections

Metaobject (Metafield) to collection

5. Displaying metaobject on the collection page

  • Navigate to your store’s Admin > Online Store > Themes >Customize
  • Top-middle template menu > Collections > Default Collections
displaying-metaobject-on-the-collection-page
  • Connect the new section to the metaobject by clicking the database (“burger”) icon
  • Match relevant items in the section/block with the appropriate entries in your meta object
collection-page-edit

Output

For instance, you could use them to store additional product information and add custom customer fields. The flexibility of these features allows you to create a more personalized experience for both your customers and your store management.

conclusion-and-output

An example of a product detail page that uses metafields and metaobjects

Replacement of App with Custom Meta Fields

We can replace some apps that are not dependent on third parties (such as tracking, and review) using metafields and liquid code. Using metafields, we can manage to upsell feature apps, so we do not have to pay for them, and this is not dependent on third parties, so it does not slow down the site.

So, When you are using an app called “upsell” on a product page/collection and you want to remove that app, it is possible from meta field customization to achieve the following result-

custom-meta-fields

Read this Blog and Find:- Create Metafields and Create Metaobjects

Latest Posts

Leave A Comment