How to Keep Separate Carts per Market in Medusa v2
A Nuxt and Medusa v2 pattern for keeping one basket per market and catching carts with the wrong currency, sales channel, or shipping country.
Give each market its own saved cart. When a shopper changes countries, load the destination market's basket and leave the original one in place. Check that the cart still belongs to the active market before using it at checkout.
I used this approach on a store with two markets that share a Nuxt codebase and a Medusa v2 backend. Each storefront deployment serves one market. Imagine a shopper adds an item in Market A, then opens Market B. The product page can show B's price even while a saved cart points to A. If that cart loads, it can show the previous currency or shipping options for the wrong country. Changing the currency symbol on screen still leaves the underlying cart in A.
Why I kept the baskets separate
Medusa's Store API lets you update the existing cart's region_id. The official Next.js starter uses that operation when a shopper changes country. That works when you want the shopper to carry one basket across markets and can recalculate prices and recheck which items, promotions, and shipping options still apply. Update a cart's region · Medusa starter cart implementation
In this store, a market switch meant going to another regional storefront. We kept each saved basket where it was created. If Market B already had a basket, it could load it. Otherwise it started empty. When the shopper returned to A, A could still load the original basket from its own cookie.
Which market owns the cart?
A Medusa region sets the currency and contains one or more countries. The sales channel is a separate part of the setup. It helps determine which products and stock locations the storefront can use. Saving a cart by currency alone would put two markets that both use euros in the same slot. Medusa multi-region recipe
On this project, the backend resolves the market from the storefront's configured site. That gives the storefront the country, region, sales channel, currency, and locale. We use the site code to name the cart cookie. When we create a cart, we send its region, sales channel, locale, and shipping country. The cart's region determines its currency. Medusa cart concepts
The cookie tells the storefront which cart to look up. Before it uses that cart, it checks the region, sales channel, and currency. If the cart has a site tag or a shipping country, those have to match as well. The backend checks the cart against the resolved market too, so checkout doesn't depend on a browser check.
If either check finds a mismatch, the storefront clears the browser's saved cart ID, opens a new empty cart for the current market, and tells the shopper why. It leaves the previous cart record in place.
What to check before launch
Run these checks in the same browser before opening a second market.
- Add a product in Market A. Switch to B. B loads its own basket or starts empty, with B's currency and shipping options.
- Add a different item in B, then return to A. A still has the first item, and B keeps its own.
- In a test environment, load a saved cart whose market no longer matches the storefront. The checkout opens an empty cart in the active market and explains what happened.
- Finish a test order in each market. Check the currency, available shipping methods, and payment options at checkout.
The approach fits stores where the country changes what can actually be bought or shipped. Multi-market storefront case study
I build and extend Medusa stores, including launches and market rollouts where checkout has to work differently by country. Medusa development · Storefront development services