Markets are coming with Spree 5.4 early March
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 Model Diagram
Key relationships:- A Store has many Markets — each market defines a selling region
- A Market has many Countries through
MarketCountryjoin records - A Country can belong to multiple Markets (across different stores)
- Markets connect to the Pricing system via
Spree::Pricing::Context
Market Attributes
| Attribute | Description | Example Value |
|---|---|---|
name | Human-readable name for the market. Must be unique per store. | North America |
currency | ISO 4217 currency code used for this market. | USD |
default_locale | Default locale/language for this market. | en |
supported_locales | Comma-separated list of additional locales supported by this market. | en,fr |
tax_inclusive | Whether prices in this market include tax. | false |
default | Whether this is the default market for the store. Only one market per store can be default. | true |
position | Sort order for market resolution priority. Lower numbers = higher priority. | 0 |
deleted_at | Soft-delete timestamp. Markets are never fully removed from the database. | nil |
Default Market
Spree::Current.market provides per-request access to the current market. The fallback chain is:
- Explicitly set market (e.g., resolved from the customer’s country)
- The store’s default market (
store.default_market)
default flag, falling back to the first market by position:
Currency and Locale
When markets are configured,Spree::Current.currency derives from the current market rather than the store:
supported_locales_list to get all available locales (always includes the default_locale):
Finding a Market by Country
Resolve which market a country belongs to using the class method:position is returned.
Countries Available for Checkout
Markets determine which countries are available during checkout. Thecountries_available_for_checkout method on Store aggregates countries from all markets:
Creating Markets
When you run
rails db:seed, Spree automatically creates a default market for each storeStore API
The Store API provides endpoints for fetching markets and resolving which market applies to a given country. All endpoints require a publishable API key.| Method | Endpoint | Description |
|---|---|---|
GET | /api/v3/store/markets | List all markets for the current store |
GET | /api/v3/store/markets/:id | Get a single market by prefixed ID |
GET | /api/v3/store/markets/resolve?country=:iso | Resolve which market a country belongs to |
GET | /api/v3/store/markets/:market_id/countries | List countries in a market |
GET | /api/v3/store/markets/:market_id/countries/:iso | Get a country with its states |
List Markets
List Markets
Returns all markets for the current store with their countries.
Resolve Market by Country
Resolve Market by Country
Determine which market applies for a given country ISO code. Useful for auto-selecting the correct currency and locale when a customer’s location is known.Returns the market object on success, or
404 if no market contains that country.List Countries in a Market
List Countries in a Market
Returns countries belonging to a specific market. Useful for populating address dropdowns during checkout.
Pricing Integration
Markets integrate with the Pricing system through theSpree::Pricing::Context. The current market is automatically included in pricing resolution, enabling market-specific Price Lists via the Market Rule.
Related Documentation
- Stores — Multi-store setup and configuration
- Pricing — Price Lists, Price Rules, and the Pricing Context
- Addresses — Countries, States, and Zones
- Internationalization — Locales, currencies, and translations

