Metafields

You can use metafields to add custom fields to objects such as products, customers, and orders. Metafields are useful for storing specialized information, such as part numbers, customer titles, or blog post summaries. They can be used by apps and channels to track data for internal use.

For example, you can use metafields in the following ways:

  • Add fields to a resource (such as a product, product variant, or customer).
  • Customize the appearance of your storefront and show more information.
  • Store and transfer data between your store and another ecommerce system such as a CRM, ERP, or IMS.
  • Track internal data that an app needs.

You need to use an app to create and manage metafields.

Metafields have three parts:

  • Namespace - A category or container that differentiates your metadata from other metafields.
  • Key - The name of the metafield.
  • Value - The content of the metafield. In most cases, the value is what will be displayed on the storefront or used by the app.

For example, the following metafields specify the washing instructions for an item of clothing:

Namespace Key Value
Acme134-instructions Wash Cold water
Acme134-instructions Dry Tumble dry

For more examples, see The metafield object.

Creating and managing metafields

To create, edit, or delete metafields, you need to use an app. The Shopify App Store has a number of metafield apps. You can also use the Metafield API to create your own app.

If you create product metafields, then you can edit their values by using the bulk editor in the Shopify admin.

You can import and export a small subset of product metafields using the product CSV. If you need to import or export more metafields than these, then use an app.

Metafield limitations

The following limitations apply to metafields:

  • You cannot search for metafields or filter by a metafield in the Shopify admin. If you have a use case where you need to do so, then try using tags instead of metafields.
  • Shopify analytics and reports do not contain information about metafields, but there are apps that provide reports that include metafields.
  • Shopify Scripts and the Wholesale channel do not support metafields.

Show metafields in the storefront

To show metafield details in your storefront, use the metafields object in your Liquid theme pages (including checkout.liquid) and in other locations where Liquid variables are supported.

For example, you could use the following Liquid code to display the example washing instructions on a product page:

{% unless product.metafields.Acme134-instructions.Wash == blank %}
Wash: {{ product.metafields.Acme134-instructions.Wash }}
{% endunless %}

If you want your customers to be able to search for, or filter by, metafields in your online store, then install a search app.

Learn more about metafields

See the following references for more information about metafields:

Ready to start selling with Shopify?

Try it free