Skip to main content

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 shopify global object provides the custom key-value pairs attached to the order. Access the following properties on shopify to read attributes such as delivery instructions, gift messages, or other information the buyer provided during checkout.

Anchor to attributes
attributes
<[] | undefined>
required

The custom key-value pairs attached to the order by the customer or by other extensions during cart or checkout. These are commonly used for delivery instructions, gift messages, or other information the buyer provides. The value is undefined if no attributes were set.


  • Look up attributes by key: Attributes are returned as an array of key-value pairs. Use Array.find() to look up a specific attribute by its key property.

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