Przejdź do głównej zawartości

Mutations overview

📄️ cartDowngradeOnLogout

Downgrade a cart to guest on logout — clears the customer association, contact details, addresses and payment selection, but keeps the line items, discount codes, selected shipping method, currency and notes. The cart id and secret are unchanged (no rotation), so the stored cart-id stays valid and the buyer keeps their items as a guest. Call from the logout flow (with the cart secret) before tearing down the auth session; the next person on a shared device then sees none of the previous buyer's data.

📄️ cartMerge

Merge a guest cart into the signed-in customer's existing cart on login. Call right after authenticating, passing the guest cart id (its secret travels in the cart credential header). Line quantities are summed per variant and the buyer's in-session checkout fields win. The returned cart keeps the SAME id and secret as the guest cart, so the stored cart-id stays valid. Requires authentication (CARTMERGEREQUIRESAUTH otherwise); refuses carts in different currencies (CARTCURRENCY_MISMATCH).

📄️ cartRecoveryRedeem

Redeem a signed cart recovery link (from an abandoned-cart email). Pass the token from the link; on success the cart is recovered and its access secret is ROTATED — the NEW secret is returned once in secret (persist it; the previous one no longer works), and the SDK sets the cart-id cookie to the recovered cart. Buyer self-service: the merchant sends the link, never takes over the cart. Returns CARTRECOVERYLINKEXPIRED / CARTRECOVERYLINKINVALID for a bad link (no cart content is exposed) and CARTNOTFOUND when the cart no longer exists.