Skip to main content

Metafields API

Requires level 1 access to protected customer data when accessing metafields attached to customer, company, or companyLocation resources.

The Metafields API provides read-only access to metafields declared in your extension's configuration on the Order status page. Use this API to read custom data from products, variants, customers, orders, and other Shopify resources associated with the order. Learn about using metafields in customer account UI extensions.

Only metafields declared in your shopify.extension.toml are available. Undeclared metafields aren't returned.

  • Display custom product data: Read metafields on products or variants to display additional information, such as care instructions, material details, or warranty terms.
  • Show customer-specific data: Access metafields on the customer resource to display loyalty points, membership tiers, or other customer-specific metadata.
  • Read order metadata: Access metafields on the order to display custom data set by your app or other extensions, such as delivery promises or fulfillment notes.

The shopify global object provides metafields requested by your extension. Access the following properties on shopify to read custom metadata attached to Shopify resources associated with the order.

Anchor to appMetafields
appMetafields
<[]>
required

The metafields requested in the shopify.extension.toml file. Metafields are custom data fields that store additional information on Shopify resources such as products, variants, customers, and the shop. These metafields are updated when there's a change in the merchandise items being purchased by the customer.

Requires level 1 access to protected customer data when accessing metafields attached to customer, company, or companyLocation resources.

Anchor to metafields
metafields
<[]>
required

The metafields associated with the order. These metafields are shared across all extensions and persist throughout the checkout session.

Deprecated

Use appMetafields instead, which provides richer data including the resource type and metafield content type.


  • Filter by resource type: The appMetafields array can contain metafields from multiple resource types (products, variants, customers, shop, and more). Filter entries by target.type to find the metafields you need.

Was this page helpful?