Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.
Attributes API
The API for interacting with cart and checkout attributes.
To store custom data, Shopify recommends that you use the Metafields API to write cart metafields.
Metafields are safer than cart attributes as they support edit and view permissions and app-reserved namespaces to prevent other apps from reading and writing data.
To store custom data, Shopify recommends that you use the Metafields API to write cart metafields.
Metafields are safer than cart attributes as they support edit and view permissions and app-reserved namespaces to prevent other apps from reading and writing data.
Anchor to StandardApiStandard Api
The base API object provided to purchase extension targets.
- Anchor to attributesattributesattributesStatefulRemoteSubscribable<Attribute[] | undefined>StatefulRemoteSubscribable<Attribute[] | undefined>requiredrequired
The custom attributes left by the customer to the merchant, either in their cart or during checkout.
Attribute
- key
The key for the attribute.
string - value
The value for the attribute.
string
Anchor to CheckoutApiCheckout Api
The API object provided to purchase.checkout extension targets.
- Anchor to applyAttributeChangeapplyAttributeChangeapplyAttributeChange(change: AttributeChange) => Promise<AttributeChangeResult>(change: AttributeChange) => Promise<AttributeChangeResult>requiredrequired
Performs an update on an attribute attached to the cart and checkout. If successful, this mutation results in an update to the value retrieved through the
attributesproperty.NoteThis method will return an error if the cart instruction
is false, or the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.Note:This method will return an error if the cart instruction
is false, or the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.Note: This method will return an error if the <a href="/docs/api/checkout-ui-extensions/apis/cart-instructions#standardapi-propertydetail-instructions">cart instruction</a> <code><span class="PreventFireFoxApplyingGapToWBR">attributes.can<wbr/>Update<wbr/>Attributes</span></code> is false, or the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.
AttributeChange
AttributeUpdateChange | AttributeRemoveChangeAttributeUpdateChange
Updates an attribute on the order. If an attribute with the provided key does not already exist, it gets created.
- key
Key of the attribute to add or update
string - type
The type of the `AttributeUpdateChange` API.
'updateAttribute' - value
Value for the attribute to add or update
string
AttributeRemoveChange
Removes an attribute on the order if an attribute with the provided key already exists.
- key
Key of the attribute to remove
string - type
The type of the `AttributeRemoveChange` API.
'removeAttribute'
AttributeChangeResult
AttributeChangeResultSuccess | AttributeChangeResultErrorAttributeChangeResultSuccess
The returned result of a successful update to an attribute.
- type
The type of the `AttributeChangeResultSuccess` API.
'success'
AttributeChangeResultError
The returned result of an unsuccessful update to an attribute with a message detailing the type of error that occurred.
- message
A message that explains the error. This message is useful for debugging. It is **not** localized, and therefore should not be presented directly to the buyer.
string - type
The type of the `AttributeChangeResultError` API.
'error'
Anchor to useApplyAttributeChangeuse Apply Attribute Change()
Returns a function to mutate the attributes property of the checkout.
Anchor to useAttributesuse Attributes()
Returns the proposed attributes applied to the checkout.
Returns the values for the specified attributes applied to the checkout.
Anchor to useAttributeValues-parametersParameters
- Anchor to keyskeyskeysstring[]string[]requiredrequired
An array of attribute keys.