arrow-right cart chevron-down chevron-left chevron-right chevron-up close menu minus play plus search share user email pinterest facebook instagram snapchat tumblr twitter vimeo linkedin youtube subscribe dogecoin dwolla forbrugsforeningen litecoin amazon_payments american_express bitcoin cirrus discover fancy interac jcb master paypal stripe visa diners_club dankort maestro trash

Shopping Cart


Shopify Insights

A Step-by-Step Tutorial on Using Shopify Metaobjects

A Step-by-Step Tutorial on Using Shopify Metaobjects

Shopify Metaobjects are data containers that merchants can create to store and organize additional data structures beyond the standard fields provided by Shopify. They essentially expand the power of Metafields by allowing merchants to group multiple Metafields together in one container (“object”).

In this tutorial, we will walk you through the process of using Shopify Metaobjects effectively, enabling you to extend your store's functionality and customize your data storage.

Step 1: Understanding Shopify Metaobjects

Before diving into the implementation, it's important to understand what Shopify Metaobjects are and how they can benefit your online store. Metaobjects are custom objects that act as containers for storing additional information related to products, collections, customers, orders, and more. They are essentially a group of Metafields making it easier to consolidate and add relevant content to your pages. You can read more about it here.

At first glance, it can be difficult to see why you would use Metaobjects instead of Metafields. But there are two main advantages to using them over Metafields:

  1. Metaobjects group many data values making it easy to update any or all of them in one place.
  2. Metaobject entries can be shared across multiple entities and not be restricted to just one entity (i.e. Products).

Step 2: Planning Your Metaobjects

To effectively use Shopify Metaobjects, start by planning the structure and hierarchy of your custom data. Consider the entities you want to associate with Metaobjects and the specific information you want to store. For example, you may want to create a Metaobject called "Shop The Look" to store products that are mentioned in a blog post.

Step 3: Creating Your Metaobjects

  1. Login to your Shopify Admin dashboard.
  2. Navigate to "Content" and click on "Metaobjects".
  3. To start creating a new Metaobject, click on "Manage definitions" over on the right side next to the “Add entry” button. Then click on “Add definition”.
  4. Give the Metaobject a Name. You’ll want to make this name descriptive so you can easily recognize its use.
  5. Add the data fields that will be stored in this Metaobject. If you’re familiar with creating Metafields, this part is very similar, since you’re essentially creating one.
  6. Provide the required information:
    1. Name: Give your Metafield a name. This should be descriptive. For example, if you want to add a title, then “Title” should be the name.
    2. Description: This is an internal description that you can add to remind you what this Metafield is for. It’s optional.
    3. Value Type: Choose the appropriate data type for your Metafield (i.e. Single line text, Product, File, etc.).
    4. Select if you’ll be adding “One value” or a “List of values”
    5. Validations: Each data type includes varies values that you can add to limit the data (i.e. Min/max character count, etc.).
    6. To save, click on “Add”
  7. Repeat steps 5 and 6 to add more data fields into the Metaobject.
  8. Ensure that “Storefronts” is checked under the “Access options”
  9. Once you’re finished, save the Metaobject.

You will always be able to go back and edit these Metaobjects if you want to add, remove or change any values. You can see all of the Metaobjects defined if you navigate to “Settings” and then click on “Custom data”. At the bottom, you’ll see the list of Metaobjects.

Step 4: Adding data to your Metaobjects

  1. Navigate to "Content" and click on "Metaobjects". Here, you’ll see a list (or maybe it’s still empty) of metaobjects that have been created and that stored data.
  2. Click on “Add entry”. You’ll see a list of the defined Metaobjects in your store. Select the one that you want to add data to.
  3. Now you’ll see all of the data fields that you added to the Metafield. So go ahead and add all of the relevant data. Keep in mind that if you’re going to use this for each and every blog post (or product, page, etc.), you’ll have to create an entry for each, which will store different data.
  4. Once you added all of the data, ensure that “Status” is set to “Active”
  5. Click “Save”

Step 5: Associating Metaobjects with Entities

Once you have created Metaobjects, you need to associate them with the relevant entities in your store.

  1. Navigate to the respective entity in your Shopify Admin (e.g., "Blog Posts" for blog post-related Metaobjects).
  2. Scroll down to the "Metafields" section.
  3. You’ll see a table with the definition names on the left. If you don’t see it, click on “Show all”
  4. Find the row with the correct Definition name”, click on the grey box to the right and select the Metaobject that you created which stores the relevant data for that entity.
  5. Save the entity.

That’s it! You’ve successfully created a Metaobject and associated it to an entity.

Lastly, you’ll need to choose where to display this data on the website itself. To do this, you go to the Theme Editor to associate the Metafield with the specific content holder.

Step 6: Add the Metaobject to your Page Content

  1. Go to “Online Store” and then click on “Themes”
  2. Find the theme that you’re working on and click on “Customize”. The Theme Editor will now open.
  3. Navigate to the relevant page template (i.e. “Blog post”)
  4. On the left, you’ll see the list of sections that are part of this page template. Click the appropriate one, or the block that is part of this section.
  5. On the right, you’ll see the list of settings and content inputs. Next to most data fields, you’ll see an icon that you can click on. Click it and you’ll see the available Metaobjects for use.
  6. Click the Metaobjects that you created, which will then give you the list of data types stored in it. Select the one you want to use.
  7. Once you’re done, you can save your changes.

 Now you're really done! 

Watch the video below to see how we create these Metaobjects for our section “Shop the Look”:

Conclusion

Shopify Metaobjects provide a powerful way to extend the functionality of your online store and store custom data structures beyond the standard fields offered by Shopify. By following this step-by-step tutorial, you can effectively create Metaobjects, associate them with entities, and customize your data storage to meet your unique business requirements. Leverage the potential of Shopify Metaobjects to unlock new possibilities and enhance your store's functionality and customization options.

Shop The Article