Skip to main content
Migrate to Polaris

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 Attributes API provides read-only access to the custom key-value pairs attached to the order. Use this API to read custom attributes attached to the order, such as delivery instructions or gift messages.

This API reads attributes that were set when the order was placed. To store your own custom data on orders, use metafields instead.

  • Display delivery instructions: Read and display special instructions the buyer provided, such as "Leave at the back door."
  • Show gift messages: Display a gift message the buyer attached to their order.
  • Process custom data: Access key-value pairs added by other extensions during checkout, such as a preferred delivery date.

The Attributes API object provides custom attributes from the order. Access the following properties on the API object to read attribute data.

Anchor to attributes
attributes
StatefulRemoteSubscribable<[] | undefined>
required

Custom key-value pairs that the buyer attached to the order during cart or checkout, commonly used for special instructions or order customization.


  • Use useAttributeValues for known keys: When you need a specific attribute, use useAttributeValues instead of filtering the full list.
  • Handle missing attributes gracefully: Attributes are optional. The list may be empty or undefined if the buyer didn't add any custom data.

  • Attribute values are always strings. If you stored structured data during checkout, you need to parse it in your extension.
  • There's no metadata about who set an attribute. You can't determine whether an attribute was set by the buyer, a theme, or another extension.

Was this page helpful?