Skip to main content

Attributes
API

The API for interacting with cart and checkout attributes.

The API object provided to this and other customer-account.order-status extension targets.

<[] | undefined>
required

Custom attributes left by the customer to the merchant, either in their cart or during checkout.

Was this section helpful?

Attribute values

Preact

import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default async () => {
render(<Extension />, document.body);
};

function Extension() {
const buyerSelectedFreeTShirt =
shopify.attributes.value
?.buyerSelectedFreeTShirt || false;
const tshirtSize =
shopify.attributes.value?.tshirtSize || '';

if (Boolean(buyerSelectedFreeTShirt) === true) {
return (
<s-text>
You selected a free t-shirt, size:{' '}
{tshirtSize}
</s-text>
);
}

return null;
}