Skip to main content
Metafields are custom data you or your apps store in Shopify: a gift message on an order, a care label on a product, a customer’s account number. Templates can print them with Liquid. The Metafields tab in the code editor shows the syntax for each kind.

Before you start: check which metafields Foliant loads

Foliant loads metafields together with the order, and it can’t load all of them. It works like this:
  • Your store needs at least one metafield definition (in the Shopify admin, Settings › Custom data). Without any definition, no metafields are loaded.
  • For each kind (orders, draft orders, customers, products and variants), Foliant loads the definitions you pinned, up to 10 per kind, in their pinned order.
  • If a kind has no pinned definitions, Foliant loads the first 10 metafields it finds for it.
So to be sure a metafield prints, give it a definition and pin it in Settings › Custom data. Changes to definitions can take up to an hour to show in documents. Replace namespace and key with your metafield’s namespace and key (for example custom.gift_message): Product and variant metafields are per item, so use them inside the line items loop:

How metafield types print

Good to know

  • An empty or missing metafield prints nothing. Use != blank to leave out its label.
  • In visual templates, print metafields with a Custom Liquid block.
  • Pick lists can show product or variant metafields as columns, in the template’s Pick list settings.