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.

App owned metafields are supported and are returned using the $app format. The fully qualified reserved namespace format such as app--{your-app-id}[--{optional-namespace}] is not supported. See app owned metafields for more information.

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


  • 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?