CartActionFailureReason
Machine-readable failure code surfaced on the reason field of a failing
. UI layers switch on this to decide whether to
show a retry button, a validation message, or a fallback redirect.
Definition
type CartActionFailureReason = 'missing-shop' | 'missing-variant' | 'missing-line' | 'missing-cart' | 'invalid-quantity' | 'invalid-code' | 'unauthorized' | 'user-error' | 'network-error' | 'provider-error';'missing-shop' | 'missing-variant' | 'missing-line' | 'missing-cart' | 'invalid-quantity' | 'invalid-code' | 'unauthorized' | 'user-error' | 'network-error' | 'provider-error'
Example
if (!result.ok && result.reason === 'user-error') {
showValidationErrors(result.userErrors ?? []);
}Related
RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter
BuyerIdentity
Optional contact details attached to an active cart to identify the buyer. Pass to createCart or via the updatebuyeridentity mutation when the consumer logs in
CartActionResult
Discriminated result returned by a server action. On success, ok: true carries the updated cart. On failure, ok: false carries a code, a human message, and opti