Top view of someone holding an phone next to laptop

Web Design & Development Insights

A Step-by-Step Tutorial on Using Shopify Metaobjects

Author: Abra

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.

A Step-by-Step Tutorial on Using Shopify Metaobjects

Shopify metaobjects let you create your own types of content and use them across your store. This tutorial walks through setting one up from start to finish, with a real example, and covers metaobject web pages, a feature many store owners don't know exists.

This post is about metaobjects only. If you need a single extra field on your products, like care instructions, a metafield is simpler. See our step-by-step tutorial on metafields for that.

Step 1: Understand what a metaobject is

A metaobject is a content type you design yourself, made up of several fields. For example, a "Designer" metaobject could have a name, a photo, a short bio and a website link. Each designer you add is an entry.

A metafield adds one field to something that already exists, like a product. A metaobject is a new kind of thing with its own fields. There are two main reasons to use one:

  • It groups related values together, so you can update all of them in one place.
  • One entry can be used in many places. A size guide entry can be shown on 80 products, and when you update it, all 80 update.

You can read more about the difference here.

Step 2: Plan your metaobject

Before you click anything, decide what the metaobject is for, which fields it needs, and where it will appear. Writing it down saves rework later.

In this tutorial we'll build a "Shop the look" metaobject to show products mentioned in a blog post. It needs:

  • A title (single line text)
  • A short description (multi-line text)
  • An image (file)
  • The products in the look (product, list of values)

Step 3: Create the metaobject definition

The definition is the structure: the name and the list of fields.

  1. In your Shopify admin, go to Content > Metaobjects (or Settings > Custom data).
  2. Click Add definition.
  3. Give it a clear name, like "Shop the look."
  4. Add a field for each piece of data. For each field, choose:
    • Name: what the field holds, like "Title."
    • Type: single line text, product, file, and so on.
    • One value or a list of values: a list lets you pick several products in one field.
    • Validations (optional): limits like a maximum number of characters.
  5. Under the access options, make sure Storefronts is selected. Without it, the content can't be shown in your store.
  6. Save.

You can come back and add, remove or change fields at any time.

Step 4: Add entries

Entries are the actual content. You'll create one entry per look.

  1. Go to Content > Metaobjects and click your definition.
  2. Click Add entry.
  3. Fill in the fields: the title, description, image and products.
  4. Make sure the status is Active. Draft entries can't be shown in your store.
  5. Save.

If every blog post gets its own look, create a separate entry for each.

Step 5: Connect entries to blog posts

To attach an entry to a blog post, the blog post needs a field that can hold it. That field is a metafield of the type "Metaobject."

  1. Go to Settings > Custom data and choose Blog posts.
  2. Click Add definition, name it (for example "Shop the look"), choose the type Metaobject and select your "Shop the look" metaobject. If you haven't done this before, see creating metafields.
  3. Save.
  4. Open a blog post and scroll to the Metafields section. If you don't see your field, click Show all.
  5. Click the field and choose the entry for that post.
  6. Save the blog post.

The same works for products, collections and pages. Just create the metafield definition for that type instead.

Step 6: Show the metaobject in your theme

  1. Go to Online Store > Themes and click Customize on your theme.
  2. Switch to the blog post template using the dropdown at the top.
  3. Select the section or block where the content should appear.
  4. Next to most settings, there's a small icon for dynamic sources. Click it, choose your "Shop the look" field, then choose which value to show, like the title or the image.
  5. Save.

Now every blog post with an entry shows its own look, using one template.

Can a metaobject have its own page?

Yes. Shopify can publish metaobject entries as web pages, each with its own URL. This is useful when the content deserves a page of its own, like a page for each designer, ingredient, store location or brand ambassador.

  1. Open your metaobject definition and, under its options, turn on Publish entries as web pages (Storefronts access needs to be on too).
  2. Add your entries.
  3. In the theme editor, create a template for that metaobject and connect its sections to the entry's fields with dynamic sources.

You design the template once, and every new entry gets a page automatically. You can then link to these pages from menus or other sections.

Common mistakes

  • Storefronts access is off. The content exists in the admin but never shows in the store.
  • The entry is a draft. Set it to Active.
  • The theme doesn't support dynamic sources in that spot. Most current themes do, but older or heavily customized themes may need a developer, or a section that supports them.
  • Using a metaobject when a metafield would do. If it's one value on one product, keep it simple.

Wrapping up

Metaobjects take a bit of setup, but once they're in place, adding new content becomes filling in a form instead of building a new page. They're one of the best ways to keep a store's content organized as it grows.

Wondering what shape your own site is in?

Get a free 27-point Website Health Check - security, speed, accessibility and SEO. Plain English, no pitch.

Check my site

More to read

Image for What Happens If You Don't Update WordPress Plugins?

What Happens If You Don't Update WordPress Plugins?

"If it's working, why touch it?" is the most natural instinct in the world - and it's exactly how most hacked WordPress sites get hacked. Here's the mechanism.

Continue reading
Image for Moving or Redesigning Your Website? Here’s How to Keep Your Email Working

Moving or Redesigning Your Website? Here’s How to Keep Your Email Working

A broken page gets noticed in minutes. Email that quietly stops arriving can go unnoticed for days. Here are the three ways a website move breaks business email, and the checklist that stops it.

Continue reading
Image for How Much Should Website Maintenance Cost?

How Much Should Website Maintenance Cost?

"How much should this cost?" is the right question, and almost nobody answers it honestly. Here's the real range, what separates a $49 plan from a $300 one, and how to work out which one you actually need.

Continue reading

Let's keep in touch

* We won't spam you or give your email to anyone.

Signup for Shopify Free Trial Try for Free