use Apply Attribute Changehook
hook
Returns a function to mutate the attributes
property of the checkout.
Anchor to useApplyAttributeChangeuse Apply Attribute Change()
use Apply Attribute Change()
(change: AttributeChange) => Promise<AttributeChangeResult>
AttributeChange
- type
The type of the `AttributeUpdateChange` API.
"updateAttribute"
- key
Key of the attribute to add or update
string
- value
Value for the attribute to add or update
string
AttributeUpdateChange
AttributeChangeResult
AttributeChangeResultSuccess | AttributeChangeResultError
AttributeChangeResultSuccess
The returned result of a successful update to an attribute.
- type
The type of the `AttributeChangeResultSuccess` API.
"success"
export interface AttributeChangeResultSuccess {
/**
* The type of the `AttributeChangeResultSuccess` API.
*/
type: 'success';
}
AttributeChangeResultError
The returned result of an unsuccessful update to an attribute with a message detailing the type of error that occurred.
- type
The type of the `AttributeChangeResultError` API.
"error"
- message
A message that explains the error. This message is useful for debugging. It is **not** localized, and therefore should not be presented directly to the buyer.
string
export interface AttributeChangeResultError {
/**
* The type of the `AttributeChangeResultError` API.
*/
type: 'error';
/**
* A message that explains the error. This message is useful for debugging.
* It is **not** localized, and therefore should not be presented directly
* to the buyer.
*/
message: string;
}
Was this section helpful?