Cart Mutations
Operations registered in src/gql/mutations/cart/*.
Available Mutations
- CreateGuestCartMutation
Operation:
createGuestCart - CreateCustomerCartMutation
Operation:
createCustomerCart - AddProductsToCartMutation
Operation:
addProductsToCart(cartId: String!, siteId: Int, items: [AddCartItemInput!]) - UpdateCartItemsMutation
Operation:
updateCartItems(cartId: String!, items: [UpdateCartItemInput!]) - RemoveItemFromCartMutation
Operation:
removeItemFromCart(cartId: String!, itemId: Int!) - ApplyCouponToCartMutation
Operation:
applyCouponToCart(cartId: String!, couponCode: String!) - ApplyGiftCardToCartMutation
Operation:
applyGiftCardToCart(cartId: String!, giftCardCode: String!, giftCardSecurityCode: String) - RemoveCouponFromCartMutation
Operation:
removeCouponFromCart(cartId: String!, couponCode: String!) - RemoveGiftCardFromCartMutation
Operation:
removeGiftCardFromCart(cartId: String!, giftCardCode: String!) - ClearCartMutation
Operation:
clearCart(cartId: String!): Boolean! - ConvertCartMutation
Operations:
convertGuestCartToCustomerCart(cartId: String!, userId: Int!),convertCustomerCartToGuestCart(cartId: String!)
How To Work With Cart Mutations
- Start with
createGuestCart(guest flow) orcreateCustomerCart(logged-in flow). - Save
cartIdin your frontend state. - Run cart item/coupon/gift card mutations against that
cartId. - Use
cartquery to refresh totals, selected methods, and validation-driven changes.
Notes
createCustomerCartrequires an authenticated GraphQL user context.- Convert mutations are intended for login/logout transitions where the cart must persist.