Skip to main content
Skip to main content
You're viewing the documentation for v1, which isn't the latest Medusa version.Latest documentation

CartContext

The cart context available if the CartProvider is used previously in the React components tree.

Properties

setCart(cart: Omit<Cart, "refundable_amount" | "refunded_total">) => voidRequired
A state function used to set the cart object.
payUseMutationResult<Response<StoreCartsRes>, Error, StorePostCartsCartPaymentSessionReq, unknown>Required
A mutation used to select a payment processor during checkout. Using it is equivalent to using the useSetPaymentSession mutation.
createCartUseMutationResult<Response<StoreCartsRes>, Error, undefined | StorePostCartReq, unknown>Required
A mutation used to create a cart. Using it is equivalent to using the useCreateCart mutation.
startCheckoutUseMutationResult<Response<StoreCartsRes>, Error, void, unknown>Required
A mutation used to initialize payment sessions during checkout. Using it is equivalent to using the useCreatePaymentSession mutation.
completeCheckoutUseMutationResult<Response<StoreCompleteCartRes>, Error, void, unknown>Required
A mutation used to complete the cart and place the order. Using it is equivalent to using the useCompleteCart mutation.
updateCartUseMutationResult<Response<StoreCartsRes>, Error, StorePostCartsCartReq, unknown>Required
A mutation used to update a cart’s details such as region, customer email, shipping address, and more. Using it is equivalent to using the useUpdateCart mutation.
addShippingMethodUseMutationResult<Response<StoreCartsRes>, Error, StorePostCartsCartShippingMethodReq, unknown>Required
A mutation used to add a shipping method to the cart during checkout. Using it is equivalent to using the useAddShippingMethodToCart mutation.
totalItemsnumberRequired
The number of items in the cart.
cartOmit<Cart, "refundable_amount" | "refunded_total">
The currently-used cart.
Was this section helpful?