Guide

Create metafields in Shopify and show them in your theme

Material, care instructions or scope of delivery have no field of their own in Shopify until you create one. This guide shows the three steps: define the metafield, fill it in on the product and display it on the product page.

To create metafields in Shopify, you need three steps: a definition that tells Shopify what kind of information is stored, a value for each product, and a place in the theme where the value appears. What metafields and metaobjects can do in general is described on the page Shopify metafields and metaobjects. This guide walks you through the setup using care instructions as an example.

Requirements

  • Access to the Shopify admin with access to products, settings and themes
  • at least one created product
  • a theme whose sections support dynamic sources
  • a clear idea of which information you want to store and in what form: free text, number, date, file or a fixed selection

Create a metafield definition in Shopify

  1. Open a product. In the Shopify admin, go to Products and open any product.

  2. Add a definition. In the Product metafields section, click Add definition.

    Product page in the Shopify admin with the Product metafields section and the Add definition button “Product metafields” section on the product with “Add definition”

  3. Enter a name. In the Name field, enter a label, for example “Care instructions”. If Shopify shows a matching standard definition below, you can accept it.

  4. Check namespace and key. Shopify generates a unique identifier from the name, such as custom.care_instructions. You can adjust it in the Namespace and key field.

  5. Select a type. Click Select type and choose the type that fits the information, for example Single line text. If several values should be possible, click One value and choose List of values.

  6. Add a description and rules. Under Add description, enter a note for everyone who fills in the field later. If the Validation section appears, use it to restrict the allowed values, for example the number of characters.

  7. Save. Click Save.

The definition applies to all products, not just the one you opened. Alternatively, you can create definitions under Settings > Custom data.

Enter a value on the product

  1. Open the product. Under Products, open the product that should get a value.
  2. Find the metafield. In the Metafields section, the definitions appear as a list. If your field does not appear there, click Show all; only pinned metafields are shown automatically.
  3. Enter the value. Click + Add next to the field and enter the text.
  4. Save. Click Save.

For many products at once, bulk editing is a good fit.

Show the metafield in your theme

The value is now saved, but not yet visible in the store. To change that, you connect it to a setting in the theme editor. Shopify calls this connection a dynamic source.

  1. Open the theme editor. Go to Online Store and click Customize next to the theme you want.
  2. Choose the product template. The editor first shows the home page. Use the Home page dropdown to select the product template.
  3. Add or select a block. Add a block that displays text to the section with the product information, or click an existing one in the sidebar.
  4. Connect a dynamic source. In the block’s text setting, click the icon for connecting a dynamic source, three stacked discs to the right of the field, and select your metafield from the list. The selection has a search.
  5. Save. Click Save and check the product page in the store.

A text setting can hold several dynamic sources, so you can mix your own text and the metafield, for example “Care:” followed by the value. Up to 50 dynamic sources per text setting and up to 100 per template are possible.

If your theme does not support dynamic sources at the place you want, the route through the theme code remains. This requires programming skills.

Common mistakes

  • Edited the wrong template. If your products use several templates, the metafield appears only where you connected it.
  • Free text instead of a fixed selection. For information with only a few possible values, a list is cleaner than text that everyone writes differently.
  • Field not pinned. If you cannot see the metafield on the product, you may think it was deleted. It is under Show all.
  • Standard definition overlooked. Ready-made definitions exist for common information. Custom fields with the same purpose mean maintaining things twice.
  • Did not check a product without a value. After connecting, also look at a product where the field is empty.
  • Did not check mobile. Additional blocks lengthen the product page. Check the view on a smartphone.

Help with metafields

If individual fields are meant to grow into a whole data structure for theme, filters and interfaces, we plan it with you: Shopify metafields and metaobjects.

FAQ

Frequently asked questions

What is a metafield in Shopify?

An additional data field that you create yourself, for example for material, dimensions or care instructions. It belongs to an area of the store, such as products, collections or customers, and has a fixed type such as text, number, date or file.

Why can’t I find my metafield in the theme editor?

Either the section or block does not support dynamic sources, or you are editing a template that does not match the metafield. A product metafield can only be connected in a product template. The type must also match the setting.

Can I use metafields for filters?

Yes. With the Shopify Search & Discovery app, you can create filters for the product catalog from metafields.

Do I have to define every metafield myself?

Not always. When you create one, Shopify suggests matching standard definitions as soon as you enter a name. Accept the suggestion if it fits what you want to store.

Contact

Want us to plan your store’s data structure with you?

Tell us briefly what you need. You will get a reply from someone who would also build your project.

Phone
+49 (0) 30 – 40 36 38 90Mon–Fri 9:00 a.m.–4:30 p.m. (CET)