Skip to main content

Metafields

Requires access to protected customer data for some properties.

The API for interacting with metafields.

The base API object provided to purchase, and customer-account.order-status extension targets.

Anchor to appMetafields
appMetafields
StatefulRemoteSubscribable<[]>
required

The metafields requested in the shopify.extension.toml file. These metafields are updated when there's a change in the merchandise items being purchased by the customer.

Requires access to protected customer data.

Tip

Cart metafields are only available on carts created via the Storefront API version 2023-04 or later.*

Anchor to metafields
metafields
StatefulRemoteSubscribable<[]>
required

The metafields that apply to the current checkout.

Metafields are stored locally on the client and are applied to the order object after the checkout completes.

These metafields are shared by all extensions running on checkout, and persist for as long as the customer is working on this checkout.

Once the order is created, you can query these metafields using the GraphQL Admin API

Returns the metafields configured with shopify.extension.toml.

Anchor to filters
filters
Default: {}

[]

Returns a single filtered Metafield or undefined.

Anchor to filters
filters
required

| undefined

Returns the current array of metafields applied to the checkout. You can optionally filter the list.

Anchor to filters
filters

[]

The API object provided to purchase.checkout extension targets.

Anchor to applyMetafieldChange
applyMetafieldChange
(change: ) => Promise<>
required

Performs an update on a piece of metadata attached to the checkout. If successful, this mutation results in an update to the value retrieved through the metafields property.

Anchor to useApplyMetafieldsChange
useApplyMetafieldsChange()

Returns a function to mutate the metafields property of the checkout.

(change: ) => Promise<>
Was this page helpful?