Skip to main content

Overview

Markets let you segment a single Store into distinct geographic regions, each with its own currency, locale, and set of countries. For example, an international store might define:
  • North America — USD, English, ships to US and Canada
  • Europe — EUR, German, ships to DE, FR, AT, NL
  • United Kingdom — GBP, English, ships to GB

Market Attributes

How Markets Work

When a customer visits your store, their country determines which market applies. The market then sets the currency, locale, and tax behavior for that session.
The resolution chain:
  1. Customer’s country is detected (from URL, geolocation, X-Spree-Country header, or manual selection)
  2. Spree finds the market containing that country
  3. The market’s currency and locale become the defaults for the session
  4. The market’s tax setting determines whether prices are shown with or without tax
If no market matches the customer’s country, the store’s default market is used.

Listing Markets

Fetch all markets for the current store, including their countries:

Resolving a Market by Country

When you know a customer’s country (e.g., from geolocation or a country picker), resolve which market applies:
Returns the market object on success, or 404 if no market contains that country. This is useful for building a country switcher — resolve the market to show the customer what currency and language they’ll get.

Countries in a Market

List countries belonging to a specific market. Useful for populating address form dropdowns during checkout:

Shipping addresses stay inside the market

A cart ships only to the countries of its own market. Saving a shipping address in any other country fails with 422 and the reason ship_address_outside_market in the error’s details.code. To ship there, move the cart to the market that sells to that country: send market_id (or that market’s currency) in the same update as the address, or before it.
Response
When a cart moves to another market, a shipping address the new market does not sell to is removed, and the customer enters a new one. A customer’s saved default address is filled in only when the market sells to its country. A cart can still come to hold an address outside its market, for example when a country is taken out of the market later. Its requirements then report ship_address_outside_market, and checkout cannot complete until the address is replaced. A draft order created by staff accepts any address while it is being edited, and is refused when it is completed if the address is outside its market. When you create orders through the Admin API, send the market_id of the market that sells to the shipping country. You can also fetch countries flat (across all markets) or include the market on a country:

Currency and Locale

Each market defines a currency and set of supported locales. When a market is resolved, its currency and locale become the defaults for the session. You can discover all available currencies and locales (aggregated from all markets) via dedicated endpoints:
See Localization for details on how to pass locale, currency, and country headers in API requests.

Tax Behavior

The tax_inclusive flag on a market decides whether the prices entered for it include tax:
  • tax_inclusive: true (common in Europe) — every customer pays the price as entered, with their country’s tax inside it
  • tax_inclusive: false (common in the US) — tax is added at checkout on top of the price
The same price is charged to every customer of the market, wherever they are. Take a €100.00 price in a market covering Germany (19%) and France (20%): Tax rates only hold the percentage for each country; the market decides whether that tax is inside the price. Spree’s own tax tables and external tax providers both read the market’s setting, and each order’s tax lines record whether their tax was included, so editing a market later never changes an order already placed. A storefront can read tax_inclusive from the market to tell the shopper whether the price they see includes tax. Prices are never adjusted for customers in another country. To charge some countries a different price, put them in a market of their own and give it a price list with a Market Rule. Before a customer enters an address, the market’s first country by name supplies the tax rate; once a shipping address is entered at checkout, that address takes over and the real rate applies. A market also chooses which tax provider works out its numbers — Spree’s own rate tables in a simple market, an external tax service in a complicated one. See Taxes.

Pricing Integration

Markets integrate with the Pricing system, enabling market-specific pricing through Price Lists with a Market Rule. This lets you set different prices for the same product in different markets — beyond just currency conversion. For example, you could price a product at $29.99 in North America and €24.99 in Europe, rather than relying on exchange rate conversion. See Pricing — Price Rules for details on configuring market-specific price lists.

Product Availability by Market

Some products may not be sold in every market: an exclusive distributor holds the rights in one territory, a licence covers only some countries, or a regulation forbids the product somewhere. Each product says which markets may see and buy it: A market added later needs nothing: all_except already includes it, and only already leaves it out. A market that excludes a product hides it completely. Listings, search, collections, product feeds and the product’s own URL all leave it out, and a cart in that market cannot add it. Availability works together with channel publishing: a customer sees a product only when it is published on their channel and their market may buy it. If a cart’s market changes after a product was added, for example because the customer switched country, the line stays in the cart. The cart’s requirements report it with the code not_available_in_market, and checkout cannot complete until the customer removes it or changes the market back. Orders placed by staff follow the same rule. Orders that were already placed are not changed. Because a cart ships only inside its market, a customer cannot pick a market that sells the product and have it delivered to one that does not. The same rule covers the other ways a product reaches an order. A promotion that adds a free gift leaves the gift out in a market that may not buy it, and an exchange cannot swap an item for a product the order’s market excludes. In the dashboard, set it in the Markets card on the product page, below the Publishing card. Through the API, write both fields together:
all_except and only need at least one market, and switching between them has to send market_ids again, since the same markets mean the opposite under the other mode. Setting the mode back to all clears the list. On a marketplace, sellers set the same two fields on their own products through the Seller API, choosing from GET /api/v3/seller/markets. With Meilisearch as the search provider, run the spree:search:reindex task once after upgrading, so products indexed before market availability existed carry their restrictions in the index too.

Setting Up Markets

Markets are managed in the admin dashboard under Settings → Markets. When you run rails db:seed, Spree automatically creates a default market for each store. To create markets programmatically, use the Admin API. See the Admin API endpoints for the full list of /markets routes and required scopes:
Update or remove a market the same way:
  • Markets (Store SDK) — Listing, resolving, and reading markets from the Store SDK
  • Pricing — Price Lists, Price Rules, and the Pricing Context
  • Addresses — Countries, states, and address forms
  • Localization — Locale, currency, and country headers in API requests
  • Translations — Resource and UI translations