Metaobjects is one of Shopify’s biggest added features in this year’s Winter update (Winter ‘23). As exciting as it sounds, it may also raise a lot of questions in the learning process of using this cool feature.
This is why in this article, I will discuss exactly how you can take advantage of it on your projects.
Being new to this feature, of course the first question we all ask is what is exactly, or what is it for?
Well, the best way to explain it is that it’s a place where we can add data that we wished existed in Shopify just like what’s already there such as products, collections, pages and articles. With Metaobjects, we can add custom data depending on what our project requires. This custom data is reusable depending on where or how you want to use it.
For example, if you are selling clothes, it would be nice to have different size charts you can assign to each product depending if it’s a t-shirt, pants or a hoodie. You will then need to create a different size chart for each of those item types.
In the past, I used to store these kinds of data in a Shopify snippet file. But now, Metaobjects makes it easier and more efficient in adding these details on a Shopify store.
Here are other examples of custom data we can add using Metaobjects:
In the following steps, we will be creating a Metaobject for brand profile, which is ideal for websites that resell products of different brands and want to display their info on the product page.
So, before you can use or assign a Metaobject, you first need to create it and define what it is and what it is about. You need to build the necessary fields for it.
1. Click ‘Add definition.’
2. Add the name of this Metaobject. We’ll call it ‘Brands.’
3. Next, click ‘Add field’ and select ‘Single line text’ and set its name to ‘Brand name.’
4. Add another field and select ‘File.’ Set the accepted files to images only. Set the name to ‘Logo.’
5. Add another field and select ‘Multi-line text.’ Set the name to ‘Description.’
6. Save it. After this, add at least one brand entry so we have data to display.
The next thing we need to do is to create a Product Metafield for the Metaobject we created since we’ll be displaying it on the product pages.
1. Go to settings > Metafields > Products
2. Click ‘Add definition.’
3. Set the name to ‘Brand.’
4. Set the ‘Namespace and key’ to ‘details.brand.’
5. Click ‘Select type’ and select ‘Metaobject.’
6. Then under ‘Reference’ select ‘Brands.’
7. Save it.
Now, for you to be able to display the brand details on each product page, you will need to assign each product their respective brands.
1. Open one of your products.
2. Scroll down to the bottom part where it says ‘Metafields.’
3. Select the brand for that product.
If you understand how Custom Data on Shopify or Shopify Liquid works, now that we’ve set up our Metaobject, Product Metafield and added at least one brand, it’s time to display it on our product page!
If you are completely new to Shopify’s custom data feature, and want to learn how to do it, you may follow my tutorial: How to Display Metaobjects on your Shopify Pages.
Setting up Metaobjects is quite straightforward but may get a bit tricky like any other newly introduced feature in the past. But it’s a very helpful and powerful one, good enough for us to spend time learning and understanding.