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.

StatefulRemoteSubscribable<[] | undefined>
required

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

Was this section helpful?

Returns the proposed attributes applied to the checkout.

[] | undefined
Was this section helpful?

Returns the values for the specified attributes applied to the checkout.

string[]
required

An array of attribute keys.

(string | undefined)[]
Was this section helpful?

Attribute values

React

import {
Text,
reactExtension,
useAttributeValues,
} from '@shopify/ui-extensions-react/customer-account';

export default reactExtension(
'customer-account.order-status.block.render',
() => <Extension />,
);

function Extension() {
const [buyerSelectedFreeTShirt, tshirtSize] =
useAttributeValues([
'buyerSelectedFreeTShirt',
'tshirtSize',
]);

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

return null;
}