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:
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.

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