Session Cart Provider Overview
SessionCartProvider
Unlike the CartProvider, SessionProvider
never interacts with the Medusa backend. It can be used to implement the user experience related to managing a cart’s items.
Its state variables are JavaScript objects living in the browser, but are in no way communicated with the backend.
You can use the SessionProvider
as a lightweight client-side cart functionality. It’s not stored in any database or on the Medusa backend.
To use SessionProvider
, you first have to insert it somewhere in your component tree below the MedusaProvider. Then, in any of the child components,
you can use the useSessionCart hook to get access to client-side cart item functionalities.