Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

setCartAttributes

Use this mutation to attach arbitrary key-value pairs to a cart. Attributes can be used to store additional metadata about the cart, such as custom order notes, referral sources, or customer preferences.

Arguments

path idID!required
The unique identifier of the cart to update.
path attributes[AttributeInput!]!required
A list of key-value pairs to set on the cart. Each attribute has a key and value field, both limited to 500 characters.

Returns

path SetCartAttributesResult.userErrors[CartError!]!
List of errors that occurred while setting cart attributes.

Example - request

Query arguments
{ "id": "{{cartId}}", "attributes": [ { "key": "gift_message", "value": "Happy Birthday!" }, { "key": "referral_source", "value": "instagram" } ] }
GraphQL
mutation ($id: ID!, $attributes: [AttributeInput!]!) { setCartAttributes(id: $id, attributes: $attributes) { userErrors { code message } } }

Example - response

{ "data": { "setCartAttributes": { "userErrors": [] } } }