Przejdź do głównej zawartości

Interface: UseCartManagerResult

Properties​

addItem​

addItem: (lines) => Promise<CartMutationOutcome>

Parameters​

lines​

CartLineInput[]

Returns​

Promise<CartMutationOutcome>


applyGiftCard​

applyGiftCard: (input) => Promise<CartMutationOutcome>

Parameters​

input​

Omit<CartApplyGiftCardInput, "cartId">

Returns​

Promise<CartMutationOutcome>


clearCart​

clearCart: () => void

Returns​

void


clearPaymentSelection​

clearPaymentSelection: (input?) => Promise<CartMutationOutcome>

Parameters​

input?​

Omit<CartClearPaymentSelectionInput, "cartId">

Returns​

Promise<CartMutationOutcome>


complete​

complete: (input?) => Promise<CartCompleteOutcome>

Finalise the cart into an Order. On success the cart-id cookie is cleared and status resets to idle — a follow-up addItem auto-creates a fresh cart, matching shop-again UX. The cart itself is NOT returned (CONVERTED/locked after completion); work with result.order for post-checkout flows (order.canCreatePayment, order.accessToken).

Parameters​

input?​

Omit<CartCompleteInput, "cartId">

Returns​

Promise<CartCompleteOutcome>


createPayment​

createPayment: (input) => Promise<PaymentSessionFragment>

Initiate a payment session for an order created by complete. NOT a cart operation (works on orderId, not cartId) — included on the manager for a single checkout-lifecycle API. Throws on userErrors[].code === 'PAYMENT_*' — branch on err.userErrors[0].code.

Parameters​

input​

PaymentCreateInput

Returns​

Promise<PaymentSessionFragment>


error​

error: string | null

Error message when status.type === 'error', otherwise null.


getCart​

getCart: () => Promise<CartFragment | null>

Returns​

Promise<CartFragment | null>


getCartId​

getCartId: () => string | null

Returns​

string | null


isLoading​

isLoading: boolean

true when status.type === 'loading'.


onExpired​

onExpired: (listener) => () => void

Parameters​

listener​

(event) => void

Returns​

() => void


removeGiftCard​

removeGiftCard: (input) => Promise<CartMutationOutcome>

Parameters​

input​

Omit<CartRemoveGiftCardInput, "cartId">

Returns​

Promise<CartMutationOutcome>


removeItem​

removeItem: (lineIds) => Promise<CartMutationOutcome>

Parameters​

lineIds​

string[]

Returns​

Promise<CartMutationOutcome>


selectPaymentMethod​

selectPaymentMethod: (input) => Promise<CartMutationOutcome>

Parameters​

input​

Omit<CartSelectPaymentMethodInput, "cartId">

Returns​

Promise<CartMutationOutcome>


selectShippingMethod​

selectShippingMethod: (input) => Promise<CartMutationOutcome>

Parameters​

input​

Omit<CartSelectShippingMethodInput, "cartId">

Returns​

Promise<CartMutationOutcome>


setBillingAddress​

setBillingAddress: (address) => Promise<CartMutationOutcome>

Parameters​

address​

CartAddressInput

Returns​

Promise<CartMutationOutcome>


setShippingAddress​

setShippingAddress: (address) => Promise<CartMutationOutcome>

Parameters​

address​

CartAddressInput

Returns​

Promise<CartMutationOutcome>


status​

status: CartManagerStatus


updateAttributes​

updateAttributes: (attributes) => Promise<CartMutationOutcome>

Parameters​

attributes​

CartAttributeInput[]

Returns​

Promise<CartMutationOutcome>


updateBuyerIdentity​

updateBuyerIdentity: (buyerIdentity) => Promise<CartMutationOutcome>

Parameters​

buyerIdentity​

CartBuyerIdentityInput

Returns​

Promise<CartMutationOutcome>


updateDiscountCodes​

updateDiscountCodes: (codes) => Promise<CartMutationOutcome>

Parameters​

codes​

string[]

Returns​

Promise<CartMutationOutcome>


updateGiftCardRecipient​

updateGiftCardRecipient: (input) => Promise<CartMutationOutcome>

Parameters​

input​

Omit<CartUpdateGiftCardRecipientInput, "cartId">

Returns​

Promise<CartMutationOutcome>


updateItem​

updateItem: (lines) => Promise<CartMutationOutcome>

Parameters​

lines​

CartLineUpdateInput[]

Returns​

Promise<CartMutationOutcome>


updateNote​

updateNote: (note) => Promise<CartMutationOutcome>

Parameters​

note​

string

Returns​

Promise<CartMutationOutcome>