AttributesAPI
API
The API for interacting with cart and checkout attributes.
Anchor to orderstatusapiOrderStatusApi
The API object provided to this and other customer-account.order-status
extension targets.
Anchor to attributes
attributes
StatefulRemoteSubscribable<[] | undefined>
required
Custom attributes left by the customer to the merchant, either in their cart or during checkout.
Was this section helpful?
Anchor to useAttributesuse Attributes()
use Attributes()
Returns the proposed attributes
applied to the checkout.
[] | undefined
Was this section helpful?
Returns the values for the specified attributes
applied to the checkout.
Anchor to useAttributeValues-parametersParameters
Anchor to keys
keys
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;
}