Returns a function to mutate the `attributes` property of the checkout.
Returns a function to mutate the `attributes` property of the checkout.
export function useApplyAttributeChange< Target extends RenderExtensionTarget = RenderExtensionTarget, >(): (change: AttributeChange) => Promise<AttributeChangeResult> { const api = useApi<Target>(); if ('applyAttributeChange' in api) { return api.applyAttributeChange; } throw new ExtensionHasNoMethodError( 'applyAttributeChange', api.extension.target, ); }
The type of the `AttributeUpdateChange` API.
Key of the attribute to add or update
Value for the attribute to add or update
The key for the attribute.
The value for the attribute.
AttributeChangeResultSuccess | AttributeChangeResultError
The returned result of a successful update to an attribute.
The type of the `AttributeChangeResultSuccess` API.
The returned result of an unsuccessful update to an attribute with a message detailing the type of error that occurred.
The type of the `AttributeChangeResultError` API.
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.