How To

How to use and display metafields on your Shopify store

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.


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 %}