Save Time With Metaobjects in Shopify

Metaobjects can save you a lot of time when you need to make changes to your online store.

The release of Shopify 2.0 introduced metafields and metaobjects, two helpful features every store owner can use without knowing how to write code as long as they use a Shopify 2.0 Theme.

Metafields and metaobjects are related but not identical.

Metafields are custom fields that extend an existing Shopify object, such as products, variants, collections, customers, orders, blog posts, and other areas of your Shopify store.

Metaobjects are custom objects that are entirely separate from an existing Shopify object. Metaobjects also have fields. These fields use the same content type classifications as metafields, which can initially be a bit confusing.

What makes metaobjects unique and a tremendous time safer is that a metafield can refer to a metaobject.

Suppose your Shopify store sells designer goods, and you want to display the designer's bio below the product description. You could add a metafield to the product object and copy the designer's bio to each product. But that would be redundant. If you had to tweak the bio, you would need to copy the new text to each product. Updating an extensive catalog can take a long time.

But there is a faster way by using a metaobject instead of a metafield.

How to Create a Metaobject

Following my example, instead of adding a metafield to the product object, you create an independent metaobject called Designer with four fields:

  • Designer-Name with the content type single-line text;

  • Designer-Headline with the content type single-line text;

  • Designer-Bio with the content type multi-line text and

  • Designer-Picture with the content type file.

Here are the steps in Shopify:

  1. Go to Shopify Admin > Content > Metaobjects.

  2. Click Add Definitions.

  3. Enter a Name and a Description.

  4. Add the Fields and select each field's Content Type.

  5. Save.

How to Add Data to a Metaobject

Adding data to an existing metaobject is straightforward, like filling out a form.

  1. Go to Shopify Admin > Content > Metaobjects.

  2. Click the metaobject to which you want to add a record. In my example, it would be the metaobject Designer.

  3. Click Add Entry.

  4. Fill out the form.

  5. Click Save.

  6. Add as many entries as you need.

How to Reference a Metaobject

To use the data you have entered in the metaobject with one of the built-in Shopify objects, you need to create a metafield that points to it.

In my example, if you want to add the designer's name to each product, add a metafield Product Designer to the product object and point it to the metaobject Designer.

  1. Go to Shopify Admin > Content > Metaobjects.

  2. Click Manage Definitions.

  3. Under Metafield Definitions, select Products.

  4. Click Assigned to all Products.

  5. Click Add Definition.

  6. Enter a Name and a Description. In my example, under Name, type in Product Designer. Enter a description.

  7. Select a Metafield Content Type. From the list of content types, choose Metaobject.

  8. Select a metaobject from the dropdown list. In my example, select the metaobject Designer.

  9. Save

The last step is to add the designer's name to each product.

  1. Go to Shopify Admin > Products.

  2. Select a product.

  3. Scroll down to Product Metafields.

  4. Click the metafield Product Designer.

  5. Select the Entry.

  6. Save.

  7. Repeat for each product.

How to Connect a Field in a Metaobject to a Theme Using the Theme Editor

If you use a Shopify 2.0 theme, you can use the built-in Theme Editor to connect a field in a metaobject to your theme without needing to write code.

  1. Go to Shopify Admin > Online Store.

  2. Under your current theme, click Customize.

  3. Select the page template at the top of the Theme Editor, for example, Home Page or Products > Default Product.

  4. Add a new section or add a new block within an existing section.

  5. Choose the section or block type, such as Collapsible Tab.

  6. Click the Collapsible Tab you just created.

  7. Under content, click the icon Connect Dynamic Source.

  8. Click Products from the menu.

  9. Select a metaobject from the list.

  10. Select a field from the list. Please note that only fields with a compatible content type will be displayed. If your field doesn't show up, the content type is likely incompatible. In this case, go back to the definition of this metaobject and change the content type of this field.

  11. Save your template.

Metaobjects — The Time Saver

Metaobjects can save you a lot of time when you need to make changes to your online store.

Suppose the bio of one of the designers in my example needs to be updated. Instead of updating each product, you simply update the entry in the metaobject. That's it.

  1. Go to Shopify Admin > Content > Metaobjects.

  2. Click the metaobject to be updated. In my example, it would be the metaobject Designer.

  3. Click the Entry to be updated.

  4. Update the form.

  5. Click Save.

Since the reference to the metaobject has not changed, the update will automatically display the next time a website visitor clicks on the product.