Shopify now allows you to create Metaobject Pages, which are different from traditional pages.
With the creation of this page, it is now easy to reflect meta objects that were previously used for backend management in the frontend.
We will explain what benefits this meta object page has and how to create it.
What is a meta object?
Meta objects are features that allow you to extend Shopify's data.
Previously, metafields allowed you to add variables to existing data structures, such as customer or product information.
However, meta objects allow you to create new data structures themselves.
This makes it possible to register new data structures such as new product feature lists, size charts, etc.
On this TechGeek site, students are registered as meta-objects.
This website is also built on Shopify, so please feel free to use it as a reference.
What is a meta object page?
A meta object page is a page that is specific to a meta object.
For example, say you have a meta object called a student.
For students,
- Person A
- B-san
Assume that the following entries are registered:
Using meta object pages, a page is created for each Shopify meta object entry, such as Person A's Profile Page, Person B's Profile Page, etc.
This is the meta object page.
You can check out the meta object pages of TechGeek students at the links below.
https://techgeek-school.com/pages/student/7136055689528
Advantages and disadvantages of meta object pages
The difference between a regular page and a metaobject page is that you can call metaobject objects within a page using Liquid.
On the other hand, the disadvantage is that it is almost impossible to build without using Liquid.
Therefore, you will need to hire a Shopify theme development engineer to build it for you.
How to create a meta object page
First, create a meta object from your Shopify store admin in Settings > Custom Data.
At that time, please check Storefront and Webpage as shown in the image below.
That way, every time you add an entry to the meta object, a new page is created.
How to develop a meta object page in Liquid
The meta object page will be developed using Liquid.
This page provides a metaobject object that can be used to obtain information about the registered entry.
For example, consider a student meta-object.
To display the registered name, the code would look like this:
{{ metaobject.name }}
Within the meta object page, you can use the metaobject object,
Also, since a page is created for each entry, even if the amount of data increases as the system is operated, like for students, pages will be created automatically.
Official Shopify documentation for metaobject
Points to note when developing meta object pages!
The only global object available to the meta object page is the customer object .
You cannot use blogs or articles.
*Information current as of September 2023. It may become available in a future update.
As a result, it is no longer possible to retrieve the meta object associated with a blog post from Liquid.
If you want to get this kind of data, the only way is via a Shopify custom app.
For example, my profile page lists the blogs I have posted.
In fact, it was not possible to obtain the data from Liquid blogs or articles, so I used a custom app to retrieve and display the data via the REST API.
In this way, meta object pages are somewhat special pages that are independent of the normal theme configuration rules.
summary
We explained what a meta object page is, how to create one, and what to look out for when developing one.
We think there are endless possibilities with Shopify's meta objects and meta fields.
We hope that you will master this technology and be able to provide a variety of value to your clients!