Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Introducing Spree Markets 🌐

Damian Legawiec88713ce1be70
diff --git a/backend/db/schema.rb b/backend/db/schema.rb
index f003947d8e..c55164a62c 100644
--- a/backend/db/schema.rb
+++ b/backend/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[8.1].define(version: 2026_02_18_156042) do
+ActiveRecord::Schema[8.1].define(version: 2026_02_20_151370) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
enable_extension "pg_trgm"
@@ -563,6 +563,27 @@ ActiveRecord::Schema[8.1].define(version: 2026_02_18_156042) do
t.index ["source_id", "source_type"], name: "index_spree_log_entries_on_source_id_and_source_type"
end
+ create_table "spree_markets", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "currency", null: false
+ t.boolean "default", default: false, null: false
+ t.string "default_locale", null: false
+ t.datetime "deleted_at"
+ t.string "name", null: false
+ t.integer "position", default: 0, null: false
+ t.bigint "store_id", null: false
+ t.string "supported_locales"
+ t.boolean "tax_inclusive", default: false, null: false
+ t.datetime "updated_at", null: false
+ t.bigint "zone_id", null: false
+ t.index ["deleted_at"], name: "index_spree_markets_on_deleted_at"
+ t.index ["store_id", "default"], name: "index_spree_markets_on_store_id_and_default", where: "(deleted_at IS NULL)"
+ t.index ["store_id", "name"], name: "index_spree_markets_on_store_id_and_name", unique: true, where: "(deleted_at IS NULL)"
+ t.index ["store_id", "position"], name: "index_spree_markets_on_store_id_and_position"
+ t.index ["store_id"], name: "index_spree_markets_on_store_id"
+ t.index ["zone_id"], name: "index_spree_markets_on_zone_id"
+ end
+
create_table "spree_metafield_definitions", force: :cascade do |t|
t.datetime "created_at", null: false
t.string "display_on", default: "both", null: false
diff --git a/backend/engines/admin/app/controllers/spree/admin/markets_controller.rb b/backend/engines/admin/app/controllers/spree/admin/markets_controller.rb
new file mode 100644
index 0000000000..0dc33839f3
--- /dev/null
+++ b/backend/engines/admin/app/controllers/spree/admin/markets_controller.rb
@@ -0,0 +1,19 @@
+module Spree
+ module Admin
+ class MarketsController < ResourceController
+ include Spree::Admin::SettingsConcern
+
+ before_action :load_data, except: :index
+
+ protected
+
+ def load_data
+ @zones = Spree::Zone.order(:name)
+ end
+
+ def permitted_resource_params
+ params.require(:market).permit(permitted_market_attributes)
+ end
+ end
+ end
+end
diff --git a/backend/engines/admin/app/views/spree/admin/markets/_form.html.erb b/backend/engines/admin/app/views/spree/admin/markets/_form.html.erb
new file mode 100644
index 0000000000..b68704f459
--- /dev/null
+++ b/backend/engines/admin/app/views/spree/admin/markets/_form.html.erb
@@ -0,0 +1,28 @@
+<div class="card mb-6">
+ <div class="card-header">
+ <h5 class="card-title">
+ <%= Spree.t(:general_settings) %>
+ </h5>
+ </div>
+
+ <div class="card-body">
+ <%= f.spree_text_field :name, required: true %>
+
+ <%= f.spree_collection_select :zone_id, @zones, :id, :name, label: Spree.t(:zone), required: true %>
+
+ <%= f.spree_select :currency, currency_options(f.object.currency), { label: Spree.t(:currency), required: true, autocomplete: true } %>
+
+ <%= f.spree_select :default_locale,
+ options_from_collection_for_select(all_locales_options, :last, :first, f.object.default_locale || I18n.locale),
+ { required: true, autocomplete: true } %>
+
+ <%= f.spree_select :supported_locales,
+ options_from_collection_for_select(all_locales_options, :last, :first, f.object.supported_locales&.split(',')),
+ { multiple: true, autocomplete: true, hint: Spree.t('admin.markets.supported_locales_hint') } %>
+
+ <hr class="my-6" />
+
+ <%= f.spree_check_box :tax_inclusive %>
+ <%= f.spree_check_box :default %>
+ </div>
+</div>
diff --git a/backend/engines/admin/app/views/spree/admin/markets/edit.html.erb b/backend/engines/admin/app/views/spree/admin/markets/edit.html.erb
new file mode 100644
index 0000000000..f5b8f8cb5d
--- /dev/null
+++ b/backend/engines/admin/app/views/spree/admin/markets/edit.html.erb
@@ -0,0 +1 @@
+<%= render 'spree/admin/shared/edit_resource' %>
diff --git a/backend/engines/admin/app/views/spree/admin/markets/index.html.erb b/backend/engines/admin/app/views/spree/admin/markets/index.html.erb
new file mode 100644
index 0000000000..33d9483959
--- /dev/null
+++ b/backend/engines/admin/app/views/spree/admin/markets/index.html.erb
@@ -0,0 +1,9 @@
+<%= content_for :page_title do %>
+ <%= Spree.t('admin.markets.list') %>
+<% end %>
+
+<% content_for :page_actions do %>
+ <%= link_to_with_icon 'plus', Spree.t('admin.markets.new'), new_object_url, class: 'btn btn-primary' if can?(:create, Spree::Market) %>
+<% end %>
+
+<%= render_table @collection, :markets %>
diff --git a/backend/engines/admin/app/views/spree/admin/markets/new.html.erb b/backend/engines/admin/app/views/spree/admin/markets/new.html.erb
new file mode 100644
index 0000000000..65a817edc9
--- /dev/null
+++ b/backend/engines/admin/app/views/spree/admin/markets/new.html.erb
@@ -0,0 +1 @@
+<%= render 'spree/admin/shared/new_resource' %>
diff --git a/backend/engines/admin/app/views/spree/admin/stores/form/_basic.html.erb b/backend/engines/admin/app/views/spree/admin/stores/form/_basic.html.erb
index 27ba1e4bb4..0704f3c63b 100644
--- a/backend/engines/admin/app/views/spree/admin/stores/form/_basic.html.erb
+++ b/backend/engines/admin/app/views/spree/admin/stores/form/_basic.html.erb
@@ -22,11 +22,11 @@
<h5 class="card-title"><%= Spree.t(:currencies) %> & <%= Spree.t(:translations) %></h5>
</div>
<div class="card-body">
- <%= f.spree_select :default_currency, currency_options(@store.default_currency), { label: Spree.t(:default_currency), autocomplete: true } %>
- <%= f.spree_select :supported_currencies, currency_options(@store.supported_currencies&.split(',')), { prompt: false, multiple: true, autocomplete: true } %>
- <hr class="my-6" />
- <%= f.spree_select :default_locale, options_from_collection_for_select(all_locales_options, :last, :first, @store.default_locale || I18n.locale), { autocomplete: true } %>
- <%= f.spree_select :supported_locales, options_from_collection_for_select(all_locales_options, :last, :first, @store.supported_locales&.split(',')), { multiple: true, autocomplete: true } %>
+ <div class="alert alert-info w-full mb-0">
+ <span>
+ Currencies and locales are now managed by <%= link_to 'Markets', spree.admin_markets_path %>.
+ </span>
+ </div>
</div>
</div>
@@ -35,7 +35,7 @@
<h5 class="card-title"><%= Spree.t(:standards_and_formats) %></h5>
</div>
<div class="card-body">
- <p class="text-gray-600">
+ <p class="text-gray-600 mb-3">
<%= Spree.t(:standards_and_formats_help) %>
</p>
<div class="form-group mb-6">
@@ -73,7 +73,7 @@
<%= f.spree_number_field :preferred_digital_asset_authorized_days, min: 1 %>
</div>
</div>
- <hr class="my-6" />
+ <hr class="my-6">
<div data-controller="reveal">
<%= f.spree_check_box :preferred_limit_digital_download_count, data: { action: 'reveal#toggle' } %>
<div data-reveal-target="item" <% unless f.object.preferred_limit_digital_download_count %>class="hidden"<% end %>>
diff --git a/backend/engines/admin/config/initializers/spree_admin_navigation.rb b/backend/engines/admin/config/initializers/spree_admin_navigation.rb
index 47d7b0d513..cc4700bc06 100644
--- a/backend/engines/admin/config/initializers/spree_admin_navigation.rb
+++ b/backend/engines/admin/config/initializers/spree_admin_navigation.rb
@@ -267,11 +267,20 @@ Rails.application.config.after_initialize do
active: -> { controller_name == 'payment_methods' },
if: -> { can?(:manage, Spree::PaymentMethod) }
+ # Markets
+ settings_nav.add :markets,
+ label: :markets,
+ url: :admin_markets_path,
+ icon: 'world',
+ position: 78,
+ active: -> { controller_name == 'markets' },
+ if: -> { can?(:manage, Spree::Market) }
+
# Zones
settings_nav.add :zones,
label: :zones,
url: :admin_zones_path,
- icon: 'world',
+ icon: 'map-2',
position: 80,
active: -> { %w[zones countries states].include?(controller_name) },
if: -> { can?(:manage, Spree::Zone) }
diff --git a/backend/engines/admin/config/initializers/spree_admin_tables.rb b/backend/engines/admin/config/initializers/spree_admin_tables.rb
index 63a0cccc4b..5fa176ce6b 100644
--- a/backend/engines/admin/config/initializers/spree_admin_tables.rb
+++ b/backend/engines/admin/config/initializers/spree_admin_tables.rb
@@ -1679,4 +1679,38 @@ Rails.application.config.after_initialize do
button_class: 'btn-danger',
method: :delete,
position: 10
+
+ # ==========================================
+ # Register Markets table
+ # ==========================================
+ Spree.admin.tables.register(:markets, model_class: Spree::Market, search_param: :name_cont)
+
+ Spree.admin.tables.markets.add :name,
+ label: :name,
+ type: :string,
+ sortable: true,
+ filterable: true,
+ default: true,
+ position: 10
+
+ Spree.admin.tables.markets.add :currency,
+ label: :currency,
+ type: :string,
+ sortable: true,
+ default: true,
+ position: 20
+
+ Spree.admin.tables.markets.add :default_locale,
+ label: :default_locale,
+ type: :string,
+ sortable: true,
+ default: true,
+ position: 30
+
+ Spree.admin.tables.markets.add :default,
+ label: :default,
+ type: :boolean,
+ sortable: true,
+ default: true,
+ position: 40
end
diff --git a/backend/engines/admin/config/locales/en.yml b/backend/engines/admin/config/locales/en.yml
index 4ee7b0ae87..22bd96bb7e 100644
--- a/backend/engines/admin/config/locales/en.yml
+++ b/backend/engines/admin/config/locales/en.yml
@@ -126,6 +126,11 @@ en:
code_help_text: If you leave it blank, we will generate code for you
redeemed: Redeemed
usage: Usage
+ markets:
+ list: Markets
+ new: New Market
+ edit: Edit Market
+ supported_locales_hint: Comma-separated list of additional locale codes (e.g. fr,de,es)
imports:
all_required_columns_mapped: Good job, all required columns are mapped!
field_required: Field required
diff --git a/backend/engines/admin/config/routes.rb b/backend/engines/admin/config/routes.rb
index aaec9cb7cb..07517683df 100644
--- a/backend/engines/admin/config/routes.rb
+++ b/backend/engines/admin/config/routes.rb
@@ -221,6 +221,7 @@ Spree::Core::Engine.add_routes do
resources :reimbursement_types
resources :refund_reasons, except: :show
resources :return_authorization_reasons, except: :show
+ resources :markets
resources :zones
resources :stock_locations, except: :show do
member do
diff --git a/backend/engines/admin/spec/controllers/spree/admin/markets_controller_spec.rb b/backend/engines/admin/spec/controllers/spree/admin/markets_controller_spec.rb
new file mode 100644
index 0000000000..436830379b
--- /dev/null
+++ b/backend/engines/admin/spec/controllers/spree/admin/markets_controller_spec.rb
@@ -0,0 +1,121 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Admin::MarketsController, type: :controller do
+ render_views
+ stub_authorization!
+
+ let(:store) { @default_store }
+ let(:zone) { create(:zone, kind: :country) }
+
+ describe 'GET #index' do
+ let!(:market) { create(:market, store: store, zone: zone) }
+
+ it 'returns a successful response' do
+ get :index
+ expect(response).to be_successful
+ end
+
+ it 'assigns @collection' do
+ get :index
+ expect(assigns(:collection)).to include(market)
+ end
+ end
+
+ describe 'GET #new' do
+ it 'returns a successful response' do
+ get :new
+ expect(response).to be_successful
+ end
+
+ it 'assigns a new market' do
+ get :new
+ expect(assigns(:market)).to be_a_new(Spree::Market)
+ end
+
+ it 'loads zones' do
+ zone
+ get :new
+ expect(assigns(:zones)).to include(zone)
+ end
+ end
+
+ describe 'POST #create' do
+ let(:valid_params) do
+ {
+ market: {
+ name: 'North America',
+ zone_id: zone.id,
+ currency: 'USD',
+ default_locale: 'en'
+ }
+ }
+ end
+
+ it 'creates a new market' do
+ expect {
+ post :create, params: valid_params
+ }.to change(Spree::Market, :count).by(1)
+ end
+
+ it 'redirects after create' do
+ post :create, params: valid_params
+ expect(response).to have_http_status(:redirect)
+ end
+
+ context 'with invalid params' do
+ it 'renders new' do
+ post :create, params: { market: { name: '' } }
+ expect(response).to have_http_status(:unprocessable_content)
+ end
+ end
+ end
+
+ describe 'GET #edit' do
+ let(:market) { create(:market, store: store, zone: zone) }
+
+ it 'returns a successful response' do
+ get :edit, params: { id: market.to_param }
+ expect(response).to be_successful
+ end
+
+ it 'loads zones' do
+ get :edit, params: { id: market.to_param }
+ expect(assigns(:zones)).to include(zone)
+ end
+ end
+
+ describe 'PUT #update' do
+ let(:market) { create(:market, store: store, zone: zone) }
+
+ it 'updates the market' do
+ put :update, params: { id: market.to_param, market: { name: 'Updated Name' } }
+ expect(market.reload.name).to eq('Updated Name')
+ end
+
+ it 'redirects after update' do
+ put :update, params: { id: market.to_param, market: { name: 'Updated Name' } }
+ expect(response).to have_http_status(:redirect)
+ end
+
+ context 'with invalid params' do
+ it 'renders edit' do
+ put :update, params: { id: market.to_param, market: { name: '' } }
+ expect(response).to have_http_status(:unprocessable_content)
+ end
+ end
+ end
+
+ describe 'DELETE #destroy' do
+ let!(:market) { create(:market, store: store, zone: zone) }
+
+ it 'soft deletes the market' do
+ delete :destroy, params: { id: market.to_param }
+ expect(market.reload.deleted_at).to be_present
+ end
+
+ it 'redirects to index' do
+ delete :destroy, params: { id: market.to_param }
+ expect(response).to have_http_status(:redirect)
+ end
+ end
+end
diff --git a/backend/engines/api/app/controllers/concerns/spree/api/v3/locale_and_currency.rb b/backend/engines/api/app/controllers/concerns/spree/api/v3/locale_and_currency.rb
index bafee6d4cd..c8f639fd8f 100644
--- a/backend/engines/api/app/controllers/concerns/spree/api/v3/locale_and_currency.rb
+++ b/backend/engines/api/app/controllers/concerns/spree/api/v3/locale_and_currency.rb
@@ -5,6 +5,7 @@ module Spree
extend ActiveSupport::Concern
included do
+ before_action :set_market_from_country
before_action :set_locale_from_header
before_action :set_currency_from_header
end
@@ -53,6 +54,19 @@ module Spree
def currency_from_params
params[:currency].presence
end
+
+ def set_market_from_country
+ country_iso = request.headers['x-spree-country'].presence || params[:country].presence
+ return unless country_iso
+
+ country = Spree::Country.find_by(iso: country_iso.upcase)
+ return unless country
+
+ market = current_store&.market_for_country(country)
+ return unless market
+
+ Spree::Current.market = market
+ end
end
end
end
diff --git a/backend/engines/api/app/controllers/spree/api/v3/store/countries_controller.rb b/backend/engines/api/app/controllers/spree/api/v3/store/countries_controller.rb
deleted file mode 100644
index 7068ce8500..0000000000
--- a/backend/engines/api/app/controllers/spree/api/v3/store/countries_controller.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-module Spree
- module Api
- module V3
- module Store
- class CountriesController < Store::BaseController
- # GET /api/v3/store/countries
- # Returns all countries available for checkout from store's checkout zone
- def index
- countries = checkout_countries.order(:name)
-
- render json: {
- data: countries.map { |country| serialize_country(country) }
- }
- end
-
- # GET /api/v3/store/countries/:id
- # Returns a single country with its states
- def show
- country = checkout_countries.find_by!(iso: params[:id].upcase)
-
- render json: serialize_country(country, include_states: true)
- end
-
- private
-
- # Get countries from the store's checkout zone
- # Falls back to all countries if no checkout zone is configured
- def checkout_countries
- zone = current_store.checkout_zone
- return Spree::Country.all unless zone
-
- zone.country_list
- end
-
- def serialize_country(country, include_states: false)
- data = Spree.api.country_serializer.new(country, params: { includes: [] }).to_h
-
- if include_states
- data[:states] = serialize_collection(country.states.order(:name), Spree.api.state_serializer)
- end
-
- data
- end
-
- def serialize_collection(collection, serializer_class)
- collection.map { |item| serializer_class.new(item).to_h }
- end
- end
- end
- end
- end
-end
diff --git a/backend/engines/api/app/controllers/spree/api/v3/store/markets/countries_controller.rb b/backend/engines/api/app/controllers/spree/api/v3/store/markets/countries_controller.rb
new file mode 100644
index 0000000000..03e736636b
--- /dev/null
+++ b/backend/engines/api/app/controllers/spree/api/v3/store/markets/countries_controller.rb
@@ -0,0 +1,45 @@
+module Spree
+ module Api
+ module V3
+ module Store
+ module Markets
+ class CountriesController < Store::BaseController
+ # GET /api/v3/store/markets/:market_id/countries
+ # Returns countries from the market's zone (for checkout address dropdown)
+ def index
+ countries = market.countries.order(:name)
+
+ render json: {
+ data: countries.map { |country| serialize_country(country) }
+ }
+ end
+
+ # GET /api/v3/store/markets/:market_id/countries/:id
+ # Returns a single country with states (for address form validation)
+ def show
+ country = market.countries.find_by!(iso: params[:id].upcase)
+
+ render json: serialize_country(country, include_states: true)
+ end
+
+ private
+
+ def market
+ @market ||= current_store.markets.find_by_prefix_id!(params[:market_id])
+ end
+
+ def serialize_country(country, include_states: false)
+ data = Spree.api.country_serializer.new(country, params: { includes: [] }).to_h
+
+ if include_states
+ data[:states] = country.states.order(:name).map { |s| Spree.api.state_serializer.new(s).to_h }
+ end
+
+ data
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/backend/engines/api/app/controllers/spree/api/v3/store/markets_controller.rb b/backend/engines/api/app/controllers/spree/api/v3/store/markets_controller.rb
new file mode 100644
index 0000000000..cf64645128
--- /dev/null
+++ b/backend/engines/api/app/controllers/spree/api/v3/store/markets_controller.rb
@@ -0,0 +1,48 @@
+module Spree
+ module Api
+ module V3
+ module Store
+ class MarketsController < Store::BaseController
+ # GET /api/v3/store/markets
+ # Returns all markets with nested countries (for country/currency switcher)
+ def index
+ markets = current_store.markets.order(:position).includes(zone: { zone_members: :zoneable })
+
+ render json: {
+ data: markets.map { |market| serialize_market(market) }
+ }
+ end
+
+ # GET /api/v3/store/markets/:id
+ # Returns a single market with countries
+ def show
+ market = current_store.markets.find_by_prefix_id!(params[:id])
+
+ render json: serialize_market(market)
+ end
+
+ # GET /api/v3/store/markets/resolve?country=DE
+ # Resolves country ISO code to market
+ def resolve
+ country_iso = params[:country]&.upcase
+ return render_error(code: 'invalid_params', message: 'country parameter is required', status: :bad_request) if country_iso.blank?
+
+ country = Spree::Country.find_by(iso: country_iso)
+ return render_error(code: 'record_not_found', message: 'country not found', status: :not_found) unless country
+
+ market = current_store.market_for_country(country)
+ return render_error(code: 'record_not_found', message: 'no market found for country', status: :not_found) unless market
+
+ render json: serialize_market(market)
+ end
+
+ private
+
+ def serialize_market(market)
+ Spree.api.market_serializer.new(market, params: serializer_params).to_h
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/backend/engines/api/app/serializers/spree/api/v3/country_serializer.rb b/backend/engines/api/app/serializers/spree/api/v3/country_serializer.rb
index 8cad12a251..6de62b7d2e 100644
--- a/backend/engines/api/app/serializers/spree/api/v3/country_serializer.rb
+++ b/backend/engines/api/app/serializers/spree/api/v3/country_serializer.rb
@@ -7,11 +7,9 @@ module Spree
# ISO 3166-1 codes - iso is the identifier, no redundant id field
typelize iso: :string, iso3: :string, name: :string,
- states_required: :boolean, zipcode_required: :boolean,
- default_currency: [:string, nullable: true], default_locale: [:string, nullable: true]
+ states_required: :boolean, zipcode_required: :boolean
- attributes :iso, :iso3, :name, :states_required, :zipcode_required,
- :default_currency, :default_locale
+ attributes :iso, :iso3, :name, :states_required, :zipcode_required
many :states,
resource: Spree.api.state_serializer,
diff --git a/backend/engines/api/app/serializers/spree/api/v3/market_serializer.rb b/backend/engines/api/app/serializers/spree/api/v3/market_serializer.rb
new file mode 100644
index 0000000000..53bb5b780e
--- /dev/null
+++ b/backend/engines/api/app/serializers/spree/api/v3/market_serializer.rb
@@ -0,0 +1,24 @@
+module Spree
+ module Api
+ module V3
+ class MarketSerializer < BaseSerializer
+ typelize name: :string, currency: :string,
+ default_locale: :string, supported_locales: 'string[]',
+ tax_inclusive: :boolean, default: :boolean,
+ countries: 'StoreCountry[]'
+
+ attributes :name, :currency, :default_locale, :tax_inclusive, :default
+
+ attribute :supported_locales do |market|
+ market.supported_locales_list
+ end
+
+ attribute :countries do |market|
+ market.countries.order(:name).map do |country|
+ Spree.api.country_serializer.new(country, params: { includes: [] }).to_h
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/backend/engines/api/config/routes.rb b/backend/engines/api/config/routes.rb
index 4bf501f2da..1aef70562c 100644
--- a/backend/engines/api/config/routes.rb
+++ b/backend/engines/api/config/routes.rb
@@ -11,8 +11,13 @@ Spree::Core::Engine.add_routes do
# Store
resource :store, only: [:show]
- # Geography - countries include nested states from checkout zone
- resources :countries, only: [:index, :show]
+ # Markets - geography + currency + locale bundles
+ resources :markets, only: [:index, :show] do
+ collection do
+ get :resolve
+ end
+ resources :countries, only: [:index, :show], controller: 'markets/countries'
+ end
# Catalog
resources :products, only: [:index, :show] do
diff --git a/backend/engines/api/lib/spree/api/dependencies.rb b/backend/engines/api/lib/spree/api/dependencies.rb
index d362bec0bc..760e2f9ee3 100644
--- a/backend/engines/api/lib/spree/api/dependencies.rb
+++ b/backend/engines/api/lib/spree/api/dependencies.rb
@@ -122,6 +122,7 @@ module Spree
order_promotion_serializer: 'Spree::Api::V3::OrderPromotionSerializer',
digital_link_serializer: 'Spree::Api::V3::DigitalLinkSerializer',
gift_card_serializer: 'Spree::Api::V3::GiftCardSerializer',
+ market_serializer: 'Spree::Api::V3::MarketSerializer',
metafield_serializer: 'Spree::Api::V3::MetafieldSerializer',
# v3 admin serializers (API v3 Admin)
diff --git a/backend/engines/api/spec/controllers/spree/api/v3/store/countries_controller_spec.rb b/backend/engines/api/spec/controllers/spree/api/v3/store/countries_controller_spec.rb
deleted file mode 100644
index c4c2e0c05b..0000000000
--- a/backend/engines/api/spec/controllers/spree/api/v3/store/countries_controller_spec.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-require 'spec_helper'
-
-RSpec.describe Spree::Api::V3::Store::CountriesController, type: :controller do
- render_views
-
- include_context 'API v3 Store'
-
- let!(:country) { create(:country) }
- let!(:country2) { create(:country) }
-
- before do
- request.headers['x-spree-api-key'] = api_key.token
- end
-
- describe 'GET #index' do
- it 'returns list of countries' do
- get :index
-
- expect(response).to have_http_status(:ok)
- expect(json_response['data']).to be_present
- expect(json_response['data'].size).to be >= 2
- end
-
- it 'returns country attributes' do
- get :index
-
- country_data = json_response['data'].first
- expect(country_data).to include('iso', 'iso3', 'name', 'states_required', 'zipcode_required')
- end
-
- context 'without API key' do
- before { request.headers['x-spree-api-key'] = nil }
-
- it 'returns unauthorized' do
- get :index
-
- expect(response).to have_http_status(:unauthorized)
- expect(json_response['error']['code']).to eq('invalid_token')
- expect(json_response['error']['message']).to be_present
- end
- end
- end
-
- describe 'GET #show' do
- it 'returns the country by iso code' do
- get :show, params: { id: country.iso }
-
- expect(response).to have_http_status(:ok)
- expect(json_response['iso']).to eq(country.iso)
- expect(json_response['name']).to eq(country.name)
- end
-
- it 'includes states' do
- state = create(:state, country: country)
- get :show, params: { id: country.iso }
-
- expect(response).to have_http_status(:ok)
- expect(json_response['states']).to be_present
- expect(json_response['states'].first['abbr']).to eq(state.abbr)
- expect(json_response['states'].first['name']).to eq(state.name)
- end
-
- context 'error handling' do
- it 'returns not found for non-existent country' do
- get :show, params: { id: 'XX' }
-
- expect(response).to have_http_status(:not_found)
- expect(json_response['error']['code']).to eq('record_not_found')
- expect(json_response['error']['message']).to be_present
- end
- end
- end
-end
diff --git a/backend/engines/api/spec/controllers/spree/api/v3/store/markets/countries_controller_spec.rb b/backend/engines/api/spec/controllers/spree/api/v3/store/markets/countries_controller_spec.rb
new file mode 100644
index 0000000000..6c31bc0fb8
--- /dev/null
+++ b/backend/engines/api/spec/controllers/spree/api/v3/store/markets/countries_controller_spec.rb
@@ -0,0 +1,58 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Api::V3::Store::Markets::CountriesController, type: :controller do
+ render_views
+
+ include_context 'API v3 Store'
+
+ let(:country) { create(:country) }
+ let(:zone) { create(:zone, kind: :country) }
+ let!(:market) { create(:market, store: store, zone: zone) }
+
+ before do
+ zone.zone_members.create!(zoneable: country)
+ request.headers['x-spree-api-key'] = api_key.token
+ end
+
+ describe 'GET #index' do
+ it 'returns countries from the market zone' do
+ get :index, params: { market_id: market.prefixed_id }
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data'].size).to eq(1)
+ expect(json_response['data'].first['iso']).to eq(country.iso)
+ end
+
+ it 'does not include states by default' do
+ create(:state, country: country)
+ get :index, params: { market_id: market.prefixed_id }
+
+ expect(json_response['data'].first).not_to have_key('states')
+ end
+ end
+
+ describe 'GET #show' do
+ it 'returns country with states' do
+ state = create(:state, country: country)
+ get :show, params: { market_id: market.prefixed_id, id: country.iso }
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['iso']).to eq(country.iso)
+ expect(json_response['states']).to be_present
+ expect(json_response['states'].first['abbr']).to eq(state.abbr)
+ end
+
+ it 'returns not found for country not in market' do
+ other_country = create(:country)
+ get :show, params: { market_id: market.prefixed_id, id: other_country.iso }
+
+ expect(response).to have_http_status(:not_found)
+ end
+
+ it 'returns not found for invalid market' do
+ get :show, params: { market_id: 'mkt_nonexistent', id: country.iso }
+
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+end
diff --git a/backend/engines/api/spec/controllers/spree/api/v3/store/markets_controller_spec.rb b/backend/engines/api/spec/controllers/spree/api/v3/store/markets_controller_spec.rb
new file mode 100644
index 0000000000..1e65a528e9
--- /dev/null
+++ b/backend/engines/api/spec/controllers/spree/api/v3/store/markets_controller_spec.rb
@@ -0,0 +1,93 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Api::V3::Store::MarketsController, type: :controller do
+ render_views
+
+ include_context 'API v3 Store'
+
+ let(:zone) { create(:zone_with_country) }
+ let!(:market) { create(:market, :default, store: store, zone: zone, name: 'North America', currency: 'USD') }
+
+ before do
+ request.headers['x-spree-api-key'] = api_key.token
+ end
+
+ describe 'GET #index' do
+ it 'returns list of markets' do
+ get :index
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data'].size).to eq(1)
+ end
+
+ it 'returns market attributes with countries' do
+ get :index
+
+ market_data = json_response['data'].first
+ expect(market_data['id']).to eq(market.prefixed_id)
+ expect(market_data['name']).to eq('North America')
+ expect(market_data['currency']).to eq('USD')
+ expect(market_data['default_locale']).to eq('en')
+ expect(market_data['supported_locales']).to eq(['en'])
+ expect(market_data['default']).to be true
+ expect(market_data['countries']).to be_an(Array)
+ end
+
+ context 'without API key' do
+ before { request.headers['x-spree-api-key'] = nil }
+
+ it 'returns unauthorized' do
+ get :index
+
+ expect(response).to have_http_status(:unauthorized)
+ end
+ end
+ end
+
+ describe 'GET #show' do
+ it 'returns the market' do
+ get :show, params: { id: market.prefixed_id }
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['id']).to eq(market.prefixed_id)
+ expect(json_response['name']).to eq('North America')
+ expect(json_response['countries']).to be_an(Array)
+ end
+
+ it 'returns not found for non-existent market' do
+ get :show, params: { id: 'mkt_nonexistent' }
+
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+
+ describe 'GET #resolve' do
+ let(:country) { zone.country_list.first }
+
+ it 'resolves country to market' do
+ get :resolve, params: { country: country.iso }
+
+ expect(response).to have_http_status(:ok)
+ expect(json_response['id']).to eq(market.prefixed_id)
+ end
+
+ it 'returns not found for country not in any market' do
+ other_country = create(:country)
+ get :resolve, params: { country: other_country.iso }
+
+ expect(response).to have_http_status(:not_found)
+ end
+
+ it 'returns bad request without country param' do
+ get :resolve, params: {}
+
+ expect(response).to have_http_status(:bad_request)
+ end
+
+ it 'returns not found for invalid country ISO' do
+ get :resolve, params: { country: 'XX' }
+
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+end
diff --git a/backend/engines/api/spec/integration/spree/api/v3/store/countries_spec.rb b/backend/engines/api/spec/integration/spree/api/v3/store/countries_spec.rb
index 8994d0a7c4..26376d075b 100644
--- a/backend/engines/api/spec/integration/spree/api/v3/store/countries_spec.rb
+++ b/backend/engines/api/spec/integration/spree/api/v3/store/countries_spec.rb
@@ -2,7 +2,7 @@
require 'swagger_helper'
-RSpec.describe 'Countries API', type: :request, swagger_doc: 'api-reference/store.yaml' do
+RSpec.describe 'Markets Countries API', type: :request, swagger_doc: 'api-reference/store.yaml' do
include_context 'API v3 Store'
let!(:usa) { Spree::Country.find_by(iso: 'US') || create(:country, iso: 'US', name: 'United States', states_required: true) }
@@ -10,14 +10,25 @@ RSpec.describe 'Countries API', type: :request, swagger_doc: 'api-reference/stor
let!(:new_york) { Spree::State.find_by(abbr: 'NY', country: usa) || create(:state, country: usa, name: 'New York', abbr: 'NY') }
let!(:germany) { Spree::Country.find_by(iso: 'DE') || create(:country, iso: 'DE', name: 'Germany', states_required: false) }
- path '/api/v3/store/countries' do
- get 'List checkout countries' do
+ let(:zone) do
+ zone = create(:zone, kind: :country)
+ zone.zone_members.create!(zoneable: usa)
+ zone.zone_members.create!(zoneable: germany)
+ zone
+ end
+ let!(:market) { create(:market, :default, store: store, zone: zone) }
+ let(:market_id) { market.prefixed_id }
+
+ path '/api/v3/store/markets/{market_id}/countries' do
+ get 'List countries in a market' do
tags 'Countries'
produces 'application/json'
security [api_key: []]
- description 'Returns countries available for checkout from the store checkout zone'
+ description 'Returns countries available in the market zone (for checkout address dropdown)'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :market_id, in: :path, type: :string, required: true,
+ description: 'Market prefixed ID (e.g., "mkt_abc123")'
response '200', 'countries found' do
let(:'x-spree-api-key') { api_key.token }
@@ -44,11 +55,9 @@ RSpec.describe 'Countries API', type: :request, swagger_doc: 'api-reference/stor
run_test! do |response|
data = JSON.parse(response.body)
expect(data['data']).to be_an(Array)
- # Find USA in response
us_country = data['data'].find { |c| c['iso'] == 'US' }
expect(us_country).to be_present
expect(us_country['name']).to be_present
- # States should NOT be included in index
expect(us_country).not_to have_key('states')
end
end
@@ -63,14 +72,16 @@ RSpec.describe 'Countries API', type: :request, swagger_doc: 'api-reference/stor
end
end
- path '/api/v3/store/countries/{iso}' do
+ path '/api/v3/store/markets/{market_id}/countries/{iso}' do
get 'Get a country with states' do
tags 'Countries'
produces 'application/json'
security [api_key: []]
- description 'Returns a single country by ISO code with its states'
+ description 'Returns a single country by ISO code with its states (for address form validation)'
parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :market_id, in: :path, type: :string, required: true,
+ description: 'Market prefixed ID (e.g., "mkt_abc123")'
parameter name: :iso, in: :path, type: :string, required: true,
description: 'Country ISO 3166-1 alpha-2 code (e.g., "US", "DE", "CA")'
@@ -103,7 +114,6 @@ RSpec.describe 'Countries API', type: :request, swagger_doc: 'api-reference/stor
data = JSON.parse(response.body)
expect(data['iso']).to eq('US')
expect(data['states']).to be_an(Array)
- # Check that states have the expected structure
state_abbrs = data['states'].map { |s| s['abbr'] }
expect(state_abbrs).to include('CA', 'NY')
end
diff --git a/backend/engines/api/spec/integration/spree/api/v3/store/markets_spec.rb b/backend/engines/api/spec/integration/spree/api/v3/store/markets_spec.rb
new file mode 100644
index 0000000000..850317058a
--- /dev/null
+++ b/backend/engines/api/spec/integration/spree/api/v3/store/markets_spec.rb
@@ -0,0 +1,147 @@
+# frozen_string_literal: true
+
+require 'swagger_helper'
+
+RSpec.describe 'Markets API', type: :request, swagger_doc: 'api-reference/store.yaml' do
+ include_context 'API v3 Store'
+
+ let!(:usa) { Spree::Country.find_by(iso: 'US') || create(:country, iso: 'US', name: 'United States') }
+ let!(:germany) { Spree::Country.find_by(iso: 'DE') || create(:country, iso: 'DE', name: 'Germany') }
+
+ let(:na_zone) do
+ zone = create(:zone, name: 'North America', kind: :country)
+ zone.zone_members.create!(zoneable: usa)
+ zone
+ end
+ let(:eu_zone) do
+ zone = create(:zone, name: 'Europe', kind: :country)
+ zone.zone_members.create!(zoneable: germany)
+ zone
+ end
+
+ let!(:na_market) { create(:market, :default, name: 'North America', store: store, zone: na_zone, currency: 'USD', default_locale: 'en') }
+ let!(:eu_market) { create(:market, name: 'Europe', store: store, zone: eu_zone, currency: 'EUR', default_locale: 'de') }
+
+ path '/api/v3/store/markets' do
+ get 'List all markets' do
+ tags 'Markets'
+ produces 'application/json'
+ security [api_key: []]
+ description 'Returns all markets for the store with their countries. Used to build country/currency switcher.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+
+ response '200', 'markets found' do
+ let(:'x-spree-api-key') { api_key.token }
+
+ schema type: :object,
+ properties: {
+ data: {
+ type: :array,
+ items: { '$ref' => '#/components/schemas/StoreMarket' }
+ }
+ },
+ required: ['data']
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['data'].size).to eq(2)
+ market_names = data['data'].map { |m| m['name'] }
+ expect(market_names).to include('North America', 'Europe')
+ na = data['data'].find { |m| m['name'] == 'North America' }
+ expect(na['currency']).to eq('USD')
+ expect(na['countries']).to be_an(Array)
+ end
+ end
+
+ response '401', 'unauthorized' do
+ let(:'x-spree-api-key') { 'invalid' }
+
+ schema '$ref' => '#/components/schemas/ErrorResponse'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/store/markets/{id}' do
+ get 'Get a market' do
+ tags 'Markets'
+ produces 'application/json'
+ security [api_key: []]
+ description 'Returns a single market by prefixed ID with its countries'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true,
+ description: 'Market prefixed ID (e.g., "mkt_abc123")'
+
+ response '200', 'market found' do
+ let(:'x-spree-api-key') { api_key.token }
+ let(:id) { na_market.prefixed_id }
+
+ schema '$ref' => '#/components/schemas/StoreMarket'
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['name']).to eq('North America')
+ expect(data['currency']).to eq('USD')
+ expect(data['default_locale']).to eq('en')
+ expect(data['countries']).to be_an(Array)
+ end
+ end
+
+ response '404', 'market not found' do
+ let(:'x-spree-api-key') { api_key.token }
+ let(:id) { 'mkt_nonexistent' }
+
+ schema '$ref' => '#/components/schemas/ErrorResponse'
+
+ run_test!
+ end
+ end
+ end
+
+ path '/api/v3/store/markets/resolve' do
+ get 'Resolve market for a country' do
+ tags 'Markets'
+ produces 'application/json'
+ security [api_key: []]
+ description 'Resolves which market a country belongs to. Used when customer selects a country.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :country, in: :query, type: :string, required: true,
+ description: 'ISO 3166-1 alpha-2 country code (e.g., "US", "DE")'
+
+ response '200', 'market resolved' do
+ let(:'x-spree-api-key') { api_key.token }
+ let(:country) { 'DE' }
+
+ schema '$ref' => '#/components/schemas/StoreMarket'
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['name']).to eq('Europe')
+ expect(data['currency']).to eq('EUR')
+ end
+ end
+
+ response '400', 'missing country parameter' do
+ let(:'x-spree-api-key') { api_key.token }
+ let(:country) { '' }
+
+ schema '$ref' => '#/components/schemas/ErrorResponse'
+
+ run_test!
+ end
+
+ response '404', 'country not found or no market' do
+ let(:'x-spree-api-key') { api_key.token }
+ let(:country) { 'XX' }
+
+ schema '$ref' => '#/components/schemas/ErrorResponse'
+
+ run_test!
+ end
+ end
+ end
+end
diff --git a/backend/engines/api/spec/swagger_helper.rb b/backend/engines/api/spec/swagger_helper.rb
index acef864566..bc35712b1f 100644
--- a/backend/engines/api/spec/swagger_helper.rb
+++ b/backend/engines/api/spec/swagger_helper.rb
@@ -72,7 +72,8 @@ RSpec.configure do |config|
{ name: 'Store', description: 'Store information and settings' },
{ name: 'Products', description: 'Product catalog browsing' },
{ name: 'Taxons', description: 'Taxonomies and categories' },
- { name: 'Countries', description: 'Available shipping countries' },
+ { name: 'Markets', description: 'Markets (region + currency + locale bundles) and market resolution' },
+ { name: 'Countries', description: 'Countries within a market zone' },
{ name: 'Cart', description: 'Shopping cart management' },
{ name: 'Checkout', description: 'Checkout flow and order updates' },
{ name: 'Orders', description: 'Order lookup' },
@@ -81,7 +82,7 @@ RSpec.configure do |config|
{ name: 'Digitals', description: 'Digital product downloads' }
],
'x-tagGroups': [
- { name: 'Store', tags: %w[Store Countries] },
+ { name: 'Store', tags: %w[Store Markets Countries] },
{ name: 'Catalog', tags: %w[Products Taxons] },
{ name: 'Cart', tags: ['Cart'] },
{ name: 'Checkout', tags: ['Checkout'] },
diff --git a/backend/engines/core/app/models/concerns/spree/stores/markets.rb b/backend/engines/core/app/models/concerns/spree/stores/markets.rb
new file mode 100644
index 0000000000..81c704060c
--- /dev/null
+++ b/backend/engines/core/app/models/concerns/spree/stores/markets.rb
@@ -0,0 +1,70 @@
+module Spree
+ module Stores
+ module Markets
+ extend ActiveSupport::Concern
+
+ included do
+ has_many :markets, class_name: 'Spree::Market', dependent: :destroy
+ end
+
+ # Returns the default market for this store
+ # @return [Spree::Market, nil]
+ def default_market
+ @default_market ||= Spree::Market.default_for_store(self)
+ end
+
+ # Returns the market that contains the given country
+ # @param country [Spree::Country]
+ # @return [Spree::Market, nil]
+ def market_for_country(country)
+ Spree::Market.for_country(country, store: self)
+ end
+
+ # Returns the countries available for checkout, derived from markets or checkout_zone
+ # @return [Array<Spree::Country>]
+ def countries_available_for_checkout
+ @countries_available_for_checkout ||= Rails.cache.fetch(countries_available_for_checkout_cache_key) do
+ if markets.any?
+ markets.flat_map(&:countries).uniq.sort_by(&:name)
+ else
+ (checkout_zone.try(:country_list) || Spree::Country.all).to_a
+ end
+ end
+ end
+
+ # Returns supported currencies derived from markets, falling back to store attributes
+ # @return [Array<Money::Currency>]
+ def supported_currencies_list
+ @supported_currencies_list ||= if markets.any?
+ markets.pluck(:currency).uniq.map do |code|
+ ::Money::Currency.find(code)
+ end.compact.sort_by { |c| c.iso_code == default_currency ? 0 : 1 }
+ else
+ legacy_supported_currencies_list
+ end
+ end
+
+ # Returns supported locales derived from markets, falling back to store attributes
+ # @return [Array<String>]
+ def supported_locales_list
+ @supported_locales_list ||= if markets.any?
+ markets.flat_map(&:supported_locales_list).uniq.sort
+ else
+ legacy_supported_locales_list
+ end
+ end
+
+ private
+
+ def legacy_supported_currencies_list
+ ([default_currency] + read_attribute(:supported_currencies).to_s.split(',')).uniq.map(&:to_s).map do |code|
+ ::Money::Currency.find(code.strip)
+ end.compact.sort_by { |currency| currency.iso_code == default_currency ? 0 : 1 }
+ end
+
+ def legacy_supported_locales_list
+ (read_attribute(:supported_locales).to_s.split(',') << default_locale).compact.uniq.sort
+ end
+ end
+ end
+end
diff --git a/backend/engines/core/app/models/spree/current.rb b/backend/engines/core/app/models/spree/current.rb
index c5f2d14bb6..883de1c510 100644
--- a/backend/engines/core/app/models/spree/current.rb
+++ b/backend/engines/core/app/models/spree/current.rb
@@ -1,17 +1,21 @@
module Spree
class Current < ::ActiveSupport::CurrentAttributes
- attribute :store, :currency, :zone, :price_lists, :global_pricing_context
+ attribute :store, :market, :currency, :zone, :price_lists, :global_pricing_context
def store
super || Spree::Store.default
end
+ def market
+ super || store&.default_market
+ end
+
def currency
- super || store&.default_currency
+ super || market&.currency || store&.default_currency
end
def zone
- super || Spree::Zone.default_tax || store&.checkout_zone
+ super || Spree::Zone.default_tax || market&.zone || store&.checkout_zone
end
def price_lists
diff --git a/backend/engines/core/app/models/spree/market.rb b/backend/engines/core/app/models/spree/market.rb
new file mode 100644
index 0000000000..d20f4d2ae0
--- /dev/null
+++ b/backend/engines/core/app/models/spree/market.rb
@@ -0,0 +1,91 @@
+module Spree
+ class Market < Spree.base_class
+ has_prefix_id :mkt
+
+ include Spree::SingleStoreResource
+
+ acts_as_paranoid
+ acts_as_list scope: :store_id
+
+ #
+ # Associations
+ #
+ belongs_to :store, class_name: 'Spree::Store'
+ belongs_to :zone, class_name: 'Spree::Zone'
+
+ #
+ # Validations
+ #
+ validates :store, :zone, presence: true
+ validates :name, presence: true, uniqueness: { scope: spree_base_uniqueness_scope + [:store_id] }
+ validates :currency, presence: true
+ validates :default_locale, presence: true
+
+ #
+ # Callbacks
+ #
+ before_save :ensure_single_default
+
+ #
+ # Scopes
+ #
+ scope :default, -> { where(default: true) }
+
+ # Find the market that contains the given country for a store
+ # Joins through zone → zone_members to match country-based or state-based zones
+ #
+ # @param country [Spree::Country] the country to look up
+ # @param store [Spree::Store] the store to scope to
+ # @return [Spree::Market, nil]
+ def self.for_country(country, store:)
+ return nil unless country && store
+
+ joins(zone: :zone_members)
+ .where(store_id: store.id)
+ .where(
+ spree_zone_members: { zoneable_type: 'Spree::Country', zoneable_id: country.id }
+ )
+ .or(
+ joins(zone: :zone_members)
+ .where(store_id: store.id)
+ .where(
+ spree_zone_members: { zoneable_type: 'Spree::State', zoneable_id: country.states.select(:id) }
+ )
+ )
+ .order(:position)
+ .first
+ end
+
+ # Returns the default market for a store, or falls back to the first by position
+ #
+ # @param store [Spree::Store]
+ # @return [Spree::Market, nil]
+ def self.default_for_store(store)
+ return nil unless store
+
+ store.markets.default.first || store.markets.order(:position).first
+ end
+
+ # Returns the countries available in this market's zone
+ #
+ # @return [ActiveRecord::Relation<Spree::Country>]
+ def countries
+ zone.country_list
+ end
+
+ # Returns supported locales as an array, always including default_locale
+ #
+ # @return [Array<String>]
+ def supported_locales_list
+ @supported_locales_list ||= (supported_locales.to_s.split(',').map(&:strip) << default_locale).compact.uniq.sort
+ end
+
+ private
+
+ def ensure_single_default
+ return unless default? && default_changed?
+
+ self.class.where(store_id: store_id, default: true).where.not(id: id).update_all(default: false)
+ end
+ end
+end
diff --git a/backend/engines/core/app/models/spree/store.rb b/backend/engines/core/app/models/spree/store.rb
index 92f647b7df..7c7b07ef30 100644
--- a/backend/engines/core/app/models/spree/store.rb
+++ b/backend/engines/core/app/models/spree/store.rb
@@ -10,6 +10,7 @@ module Spree
include Spree::Metadata
include Spree::Stores::Setup
include Spree::Stores::Socials
+ include Spree::Stores::Markets
include Spree::Security::Stores if defined?(Spree::Security::Stores)
include Spree::UserManagement
@@ -115,6 +116,7 @@ module Spree
has_many :api_keys, class_name: 'Spree::ApiKey', dependent: :destroy
+
#
# ActionText
#
@@ -160,7 +162,6 @@ module Spree
before_validation :ensure_default_country
before_validation :set_default_code, on: :create
before_save :ensure_default_exists_and_is_unique
- before_save :ensure_supported_currencies, :ensure_supported_locales
after_create :ensure_default_taxonomies_are_created
after_create :ensure_default_automatic_taxons
after_create :ensure_default_post_categories_are_created
@@ -225,12 +226,6 @@ module Spree
end
end
- def supported_currencies_list
- @supported_currencies_list ||= ([default_currency] + read_attribute(:supported_currencies).to_s.split(',')).uniq.map(&:to_s).map do |code|
- ::Money::Currency.find(code.strip)
- end.compact.sort_by { |currency| currency.iso_code == default_currency ? 0 : 1 }
- end
-
def seo_meta_description
if meta_description.present?
meta_description
@@ -241,10 +236,6 @@ module Spree
end
end
- def supported_locales_list
- @supported_locales_list ||= (read_attribute(:supported_locales).to_s.split(',') << default_locale).compact.uniq.sort
- end
-
def unique_name
@unique_name ||= "#{name} (#{code})"
end
@@ -284,14 +275,6 @@ module Spree
formatted_url
end
- # Returns the countries available for checkout for the store or creates a new one if it doesn't exist
- # @return [Array<Spree::Country>]
- def countries_available_for_checkout
- @countries_available_for_checkout ||= Rails.cache.fetch(countries_available_for_checkout_cache_key) do
- (checkout_zone.try(:country_list) || Spree::Country.all).to_a
- end
- end
-
# Returns the states available for checkout for the store or creates a new one if it doesn't exist
# @param country [Spree::Country] the country to get the states for
# @return [Array<Spree::State>]
@@ -362,22 +345,6 @@ module Spree
"#{cache_key_with_version}/#{checkout_zone&.cache_key_with_version}/states_available_for_checkout/#{country&.cache_key_with_version}"
end
- def ensure_supported_locales
- return unless attributes.keys.include?('supported_locales')
- return if supported_locales.present?
- return if default_locale.blank?
-
- self.supported_locales = default_locale
- end
-
- def ensure_supported_currencies
- return unless attributes.keys.include?('supported_currencies')
- return if supported_currencies.present?
- return if default_currency.blank?
-
- self.supported_currencies = default_currency
- end
-
def clear_cache
Rails.cache.delete('default_store')
end
diff --git a/backend/engines/core/app/services/spree/seeds/all.rb b/backend/engines/core/app/services/spree/seeds/all.rb
index 2a60d0cf2a..4fdc2c2fd3 100644
--- a/backend/engines/core/app/services/spree/seeds/all.rb
+++ b/backend/engines/core/app/services/spree/seeds/all.rb
@@ -26,6 +26,7 @@ module Spree
AdminUser.call
# add store resources
+ Markets.call
PaymentMethods.call
end
end
diff --git a/backend/engines/core/app/services/spree/seeds/markets.rb b/backend/engines/core/app/services/spree/seeds/markets.rb
new file mode 100644
index 0000000000..127c6702c1
--- /dev/null
+++ b/backend/engines/core/app/services/spree/seeds/markets.rb
@@ -0,0 +1,24 @@
+module Spree
+ module Seeds
+ class Markets
+ prepend Spree::ServiceModule::Base
+
+ def call
+ Spree::Store.all.each do |store|
+ next if store.markets.any?
+
+ zone = store.checkout_zone || Spree::Zone.find_by(name: 'North America') || Spree::Zone.first
+ next unless zone
+
+ store.markets.create!(
+ name: 'Default',
+ currency: store.default_currency,
+ default_locale: store.default_locale || I18n.locale.to_s,
+ zone: zone,
+ default: true
+ )
+ end
+ end
+ end
+ end
+end
diff --git a/backend/engines/core/config/locales/en.yml b/backend/engines/core/config/locales/en.yml
index ebfc727e1a..b85fa21c7e 100644
--- a/backend/engines/core/config/locales/en.yml
+++ b/backend/engines/core/config/locales/en.yml
@@ -1359,6 +1359,8 @@ en:
mark_as_default: Mark as default
master: Master
master_price: Master Price
+ market: Market
+ markets: Markets
master_sku: Master SKU
match_choices:
all: All
diff --git a/backend/engines/core/db/migrate/20260220000000_create_spree_markets.rb b/backend/engines/core/db/migrate/20260220000000_create_spree_markets.rb
new file mode 100644
index 0000000000..4f535d88e7
--- /dev/null
+++ b/backend/engines/core/db/migrate/20260220000000_create_spree_markets.rb
@@ -0,0 +1,22 @@
+class CreateSpreeMarkets < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_markets do |t|
+ t.references :store, null: false, foreign_key: false, index: true
+ t.string :name, null: false
+ t.string :currency, null: false
+ t.references :zone, null: false, foreign_key: false
+ t.string :default_locale, null: false
+ t.string :supported_locales
+ t.boolean :tax_inclusive, null: false, default: false
+ t.boolean :default, null: false, default: false
+ t.integer :position, null: false, default: 0
+ t.timestamps
+ t.datetime :deleted_at
+ end
+
+ add_index :spree_markets, [:store_id, :name], unique: true, where: 'deleted_at IS NULL'
+ add_index :spree_markets, [:store_id, :default], where: 'deleted_at IS NULL'
+ add_index :spree_markets, [:store_id, :position]
+ add_index :spree_markets, :deleted_at
+ end
+end
diff --git a/backend/engines/core/lib/spree/permitted_attributes.rb b/backend/engines/core/lib/spree/permitted_attributes.rb
index ab8dad1804..bf45eec53b 100644
--- a/backend/engines/core/lib/spree/permitted_attributes.rb
+++ b/backend/engines/core/lib/spree/permitted_attributes.rb
@@ -23,6 +23,7 @@ module Spree
:inventory_unit_attributes,
:invitation_attributes,
:line_item_attributes,
+ :market_attributes,
:menu_attributes,
:menu_item_attributes,
:metafield_attributes,
@@ -141,6 +142,9 @@ module Spree
@@line_item_attributes = [:id, :variant_id, :quantity]
+ @@market_attributes = [:name, :currency, :zone_id, :default_locale, :supported_locales,
+ :tax_inclusive, :default, :position]
+
@@menu_attributes = [:name, :locale, :location]
@@menu_item_attributes = [:name, :subtitle, :destination, :new_window, :item_type,
diff --git a/backend/engines/core/lib/spree/testing_support/factories/market_factory.rb b/backend/engines/core/lib/spree/testing_support/factories/market_factory.rb
new file mode 100644
index 0000000000..7eb50414b4
--- /dev/null
+++ b/backend/engines/core/lib/spree/testing_support/factories/market_factory.rb
@@ -0,0 +1,20 @@
+FactoryBot.define do
+ factory :market, class: Spree::Market do
+ sequence(:name) { |n| "Market #{n}" }
+ currency { 'USD' }
+ default_locale { 'en' }
+ store
+ zone { association :zone_with_country }
+
+ trait :default do
+ default { true }
+ end
+
+ trait :eu do
+ name { 'Europe' }
+ currency { 'EUR' }
+ default_locale { 'de' }
+ tax_inclusive { true }
+ end
+ end
+end
diff --git a/backend/engines/core/lib/tasks/markets.rake b/backend/engines/core/lib/tasks/markets.rake
new file mode 100644
index 0000000000..8eb5110c0c
--- /dev/null
+++ b/backend/engines/core/lib/tasks/markets.rake
@@ -0,0 +1,27 @@
+namespace :spree do
+ namespace :markets do
+ desc 'Create default markets for stores that do not have any markets'
+ task create_defaults: :environment do
+ Spree::Store.find_each do |store|
+ next if store.markets.exists?
+
+ zone = store.checkout_zone
+ unless zone
+ puts " Skipping store '#{store.name}' (#{store.code}) — no checkout zone configured"
+ next
+ end
+
+ market = store.markets.create!(
+ name: 'Default',
+ currency: store.default_currency,
+ zone: zone,
+ default_locale: store.default_locale || 'en',
+ supported_locales: store.read_attribute(:supported_locales),
+ default: true
+ )
+
+ puts " Created default market '#{market.name}' for store '#{store.name}' (#{store.code})"
+ end
+ end
+ end
+end
diff --git a/backend/engines/core/spec/models/spree/market_spec.rb b/backend/engines/core/spec/models/spree/market_spec.rb
new file mode 100644
index 0000000000..b950f5af40
--- /dev/null
+++ b/backend/engines/core/spec/models/spree/market_spec.rb
@@ -0,0 +1,114 @@
+require 'spec_helper'
+
+RSpec.describe Spree::Market, type: :model do
+ let(:store) { create(:store) }
+
+ describe 'validations' do
+ subject { build(:market, store: store) }
+
+ it { is_expected.to validate_presence_of(:store) }
+ it { is_expected.to validate_presence_of(:zone) }
+ it { is_expected.to validate_presence_of(:name) }
+ it { is_expected.to validate_presence_of(:currency) }
+ it { is_expected.to validate_presence_of(:default_locale) }
+
+ it 'validates uniqueness of name scoped to store' do
+ create(:market, name: 'North America', store: store)
+ market = build(:market, name: 'North America', store: store)
+ expect(market).not_to be_valid
+ expect(market.errors[:name]).to be_present
+ end
+ end
+
+ describe '.for_country' do
+ let(:country) { create(:country) }
+ let(:zone) { create(:zone, kind: :country) }
+
+ before do
+ zone.zone_members.create!(zoneable: country)
+ end
+
+ it 'finds market by country through zone' do
+ market = create(:market, store: store, zone: zone)
+ result = described_class.for_country(country, store: store)
+ expect(result).to eq(market)
+ end
+
+ it 'returns nil when no market matches' do
+ other_country = create(:country)
+ create(:market, store: store, zone: zone)
+ result = described_class.for_country(other_country, store: store)
+ expect(result).to be_nil
+ end
+
+ it 'returns nil when country is nil' do
+ expect(described_class.for_country(nil, store: store)).to be_nil
+ end
+ end
+
+ describe '.default_for_store' do
+ it 'returns default market' do
+ create(:market, store: store)
+ default = create(:market, :default, store: store)
+ expect(described_class.default_for_store(store)).to eq(default)
+ end
+
+ it 'falls back to first by position' do
+ market = create(:market, store: store, position: 1)
+ create(:market, store: store, position: 2)
+ expect(described_class.default_for_store(store)).to eq(market)
+ end
+
+ it 'returns nil for store without markets' do
+ expect(described_class.default_for_store(store)).to be_nil
+ end
+ end
+
+ describe '#countries' do
+ it 'delegates to zone.country_list' do
+ zone = create(:zone_with_country)
+ market = build(:market, zone: zone)
+ expect(market.countries).to eq(zone.country_list)
+ end
+ end
+
+ describe '#supported_locales_list' do
+ it 'returns default_locale when supported_locales is blank' do
+ market = build(:market, default_locale: 'en', supported_locales: nil)
+ expect(market.supported_locales_list).to eq(['en'])
+ end
+
+ it 'includes both supported_locales and default_locale' do
+ market = build(:market, default_locale: 'en', supported_locales: 'fr,de')
+ expect(market.supported_locales_list).to eq(['de', 'en', 'fr'])
+ end
+
+ it 'deduplicates locales' do
+ market = build(:market, default_locale: 'en', supported_locales: 'en,fr')
+ expect(market.supported_locales_list).to eq(['en', 'fr'])
+ end
+ end
+
+ describe '#ensure_single_default' do
+ it 'clears other default markets when setting default' do
+ first = create(:market, :default, store: store)
+ second = create(:market, :default, store: store)
+ expect(first.reload.default).to be false
+ expect(second.reload.default).to be true
+ end
+
+ it 'does not affect markets in other stores' do
+ other_store = create(:store)
+ other_default = create(:market, :default, store: other_store)
+ create(:market, :default, store: store)
+ expect(other_default.reload.default).to be true
+ end
+ end
+
+ describe 'has_prefix_id' do
+ it 'generates prefixed id with mkt prefix' do
+ market = create(:market, store: store)
+ expect(market.prefixed_id).to start_with('mkt_')
+ end
+ end
+end
diff --git a/backend/engines/core/spec/models/spree/store_spec.rb b/backend/engines/core/spec/models/spree/store_spec.rb
index d6d799796d..1609423a22 100644
--- a/backend/engines/core/spec/models/spree/store_spec.rb
+++ b/backend/engines/core/spec/models/spree/store_spec.rb
@@ -397,7 +397,30 @@ describe Spree::Store, type: :model, without_global_store: true do
describe '#countries_available_for_checkout' do
subject { create(:store) }
- context do
+ context 'with markets' do
+ let(:zone1) do
+ create(:zone, kind: 'country').tap do |z|
+ z.members.create(zoneable: create(:country, name: 'Germany', iso: 'DE'))
+ end
+ end
+ let(:zone2) do
+ create(:zone, kind: 'country').tap do |z|
+ z.members.create(zoneable: create(:country, name: 'France', iso: 'FR'))
+ end
+ end
+
+ before do
+ create(:market, store: subject, zone: zone1, currency: 'EUR', default: true)
+ create(:market, store: subject, zone: zone2, currency: 'EUR')
+ end
+
+ it 'returns countries from all markets' do
+ countries = subject.countries_available_for_checkout
+ expect(countries.map(&:iso)).to contain_exactly('DE', 'FR')
+ end
+ end
+
+ context 'without markets (legacy)' do
include_context 'with checkout zone set'
it 'returns country list for checkout zone' do
@@ -405,7 +428,7 @@ describe Spree::Store, type: :model, without_global_store: true do
end
end
- context do
+ context 'without markets and without checkout zone (legacy)' do
include_context 'with checkout zone not set'
it 'returns list of all countries' do
@@ -554,79 +577,127 @@ describe Spree::Store, type: :model, without_global_store: true do
end
describe '#supported_currencies_list' do
- context 'with supported currencies set' do
- let(:currencies) { 'USD, EUR, dummy' }
- let!(:store) { build(:store, default_currency: 'USD', supported_currencies: currencies) }
+ context 'with markets' do
+ let!(:store) { create(:store, default_currency: 'USD') }
+
+ before do
+ create(:market, store: store, currency: 'USD', default: true)
+ create(:market, store: store, currency: 'EUR')
+ end
- it 'returns supported currencies list' do
+ it 'derives currencies from markets' do
expect(store.supported_currencies_list).to contain_exactly(
- ::Money::Currency.find('EUR'), ::Money::Currency.find('USD')
+ ::Money::Currency.find('USD'), ::Money::Currency.find('EUR')
)
end
+
+ it 'puts default currency first' do
+ expect(store.supported_currencies_list.first.iso_code).to eq('USD')
+ end
end
- context 'without supported currencies set' do
- let!(:store) { build(:store, default_currency: 'EUR', supported_currencies: nil) }
+ context 'without markets (legacy)' do
+ context 'with supported currencies set' do
+ let(:currencies) { 'USD, EUR, dummy' }
+ let!(:store) { build(:store, default_currency: 'USD', supported_currencies: currencies) }
- it 'returns supported currencies list' do
- expect(store.supported_currencies_list).to contain_exactly(
- ::Money::Currency.find('EUR')
- )
+ it 'returns supported currencies list' do
+ expect(store.supported_currencies_list).to contain_exactly(
+ ::Money::Currency.find('EUR'), ::Money::Currency.find('USD')
+ )
+ end
+ end
+
+ context 'without supported currencies set' do
+ let!(:store) { build(:store, default_currency: 'EUR', supported_currencies: nil) }
+
+ it 'returns default currency only' do
+ expect(store.supported_currencies_list).to contain_exactly(
+ ::Money::Currency.find('EUR')
+ )
+ end
end
end
end
describe '#supported_locales_list' do
- context 'with supported locale set' do
- let(:store) { build(:store, default_locale: 'fr', supported_locales: 'fr,de') }
+ context 'with markets' do
+ let!(:store) { create(:store, default_locale: 'en') }
- it 'returns supported currencies list' do
- expect(store.supported_locales_list).to be_an_instance_of(Array)
- expect(store.supported_locales_list).to contain_exactly('de', 'fr')
+ before do
+ create(:market, store: store, default_locale: 'en', supported_locales: 'en,fr', default: true)
+ create(:market, store: store, default_locale: 'de', supported_locales: 'de')
+ end
+
+ it 'derives locales from markets' do
+ expect(store.supported_locales_list).to contain_exactly('de', 'en', 'fr')
end
end
- context 'without supported currencies set' do
- let(:store) { build(:store, default_locale: nil, supported_locales: nil) }
+ context 'without markets (legacy)' do
+ context 'with supported locales set' do
+ let(:store) { build(:store, default_locale: 'fr', supported_locales: 'fr,de') }
+
+ it 'returns supported locales list' do
+ expect(store.supported_locales_list).to contain_exactly('de', 'fr')
+ end
+ end
+
+ context 'without supported locales set' do
+ let(:store) { build(:store, default_locale: nil, supported_locales: nil) }
- it 'returns supported currencies list' do
- expect(store.supported_locales_list).to be_an_instance_of(Array)
- expect(store.supported_locales_list).to be_empty
+ it 'returns empty array' do
+ expect(store.supported_locales_list).to be_empty
+ end
end
end
end
- describe '#ensure_supported_locales' do
- context 'store with default_locale' do
- let(:store) { build(:store, default_locale: 'fr', supported_locales: nil) }
+ describe '#default_market' do
+ let!(:store) { create(:store) }
+
+ context 'with a default market' do
+ let!(:market) { create(:market, :default, store: store) }
+ let!(:other_market) { create(:market, store: store) }
- it { expect { store.save! }.to change(store, :supported_locales).from(nil).to('fr') }
+ it 'returns the default market' do
+ expect(store.default_market).to eq(market)
+ end
end
- context 'store without default locale' do
- let(:store) { build(:store, default_locale: nil, supported_locales: nil) }
+ context 'without a default market' do
+ let!(:market1) { create(:market, store: store, position: 2) }
+ let!(:market2) { create(:market, store: store, position: 1) }
- it { expect { store.save! }.not_to change(store, :supported_locales).from(nil) }
+ it 'falls back to the first market by position' do
+ expect(store.default_market).to eq(market2)
+ end
end
- context 'store with supported locales' do
- let(:store) { build(:store, default_locale: 'fr', supported_locales: 'fr,de') }
-
- it { expect { store.save! }.not_to change(store, :supported_locales) }
+ context 'without any markets' do
+ it 'returns nil' do
+ expect(store.default_market).to be_nil
+ end
end
end
- describe '#ensure_supported_currencies' do
- context 'store with default_currency' do
- let(:store) { build(:store, default_currency: 'EUR', supported_currencies: nil) }
-
- it { expect { store.save! }.to change(store, :supported_currencies).from(nil).to('EUR') }
+ describe '#market_for_country' do
+ let!(:store) { create(:store) }
+ let!(:country) { create(:country) }
+ let!(:zone) do
+ create(:zone, kind: 'country').tap do |z|
+ z.members.create(zoneable: country)
+ end
end
+ let!(:market) { create(:market, store: store, zone: zone) }
- context 'store with supported currencies' do
- let(:store) { build(:store, default_currency: 'EUR', supported_currencies: 'EUR,GBP') }
+ it 'returns the market containing the country' do
+ expect(store.market_for_country(country)).to eq(market)
+ end
- it { expect { store.save! }.not_to change(store, :supported_currencies) }
+ it 'returns nil for a country not in any market' do
+ other_country = create(:country)
+ expect(store.market_for_country(other_country)).to be_nil
end
end
diff --git a/docs/api-reference/store.yaml b/docs/api-reference/store.yaml
index 2e244f43d1..fe755fc1c8 100644
--- a/docs/api-reference/store.yaml
+++ b/docs/api-reference/store.yaml
@@ -530,14 +530,14 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImV4cCI6MTc3MTY1OTE0MH0.pgw9lfy12wSFJgEuci0lLYyUnm80mk6cJPzzyltOHCU
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImV4cCI6MTc3MTY4NTk3N30.VgnynEptFoM-d2vXBbJgzl6WYu9J3Uc2nWdGVy-Qh5o
user:
id: cus_UkLWZg9DAJ
- first_name: Ardith
- last_name: Gibson
- created_at: '2026-02-20T07:32:20.151Z'
- updated_at: '2026-02-20T07:32:20.151Z'
+ first_name: Marina
+ last_name: Rogahn
+ created_at: '2026-02-20T14:59:37.318Z'
+ updated_at: '2026-02-20T14:59:37.318Z'
addresses: []
default_billing_address:
default_shipping_address:
@@ -593,14 +593,14 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImV4cCI6MTc3MTY1OTE0MX0.5gCFi2WOjunFzAmYUlbp62W0YZpNPEtSAhkRwMD33mo
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImV4cCI6MTc3MTY4NTk3OH0.YyXSh40eY0F1rqsIJ1na5m4X5uZQkSaOxR_suvz2R6Y
user:
id: cus_UkLWZg9DAJ
first_name: John
last_name: Doe
- created_at: '2026-02-20T07:32:21.549Z'
- updated_at: '2026-02-20T07:32:21.549Z'
+ created_at: '2026-02-20T14:59:38.700Z'
+ updated_at: '2026-02-20T14:59:38.700Z'
addresses: []
default_billing_address:
default_shipping_address:
@@ -672,14 +672,14 @@ paths:
content:
application/json:
example:
- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImV4cCI6MTc3MTY1OTE0Mn0.sFK-ZFus0kUmyiMSahOQnirE6NCNwsUZ9sjoklm6lAk
+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImV4cCI6MTc3MTY4NTk3OX0.hIjxAWyuVesA4bC4_5HO6U6zu8XzW1jtpB7Vk_BY7xY
user:
id: cus_UkLWZg9DAJ
- first_name: Thaddeus
- last_name: Bruen
- created_at: '2026-02-20T07:32:22.102Z'
- updated_at: '2026-02-20T07:32:22.102Z'
+ first_name: Danelle
+ last_name: Kub
+ created_at: '2026-02-20T14:59:39.251Z'
+ updated_at: '2026-02-20T14:59:39.251Z'
addresses: []
default_billing_address:
default_shipping_address:
@@ -724,10 +724,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R820576079
+ number: R446099536
state: cart
- token: SgAsqgFXBTM12PseXwgAnyANg9sBdCB4gda
+ token: Zrhw9yjVHgsEs8UKDMCM1Cf4VoeC1JrnoyT
special_instructions:
currency: USD
item_count: 0
@@ -750,8 +750,8 @@ paths:
total: '0.0'
display_total: "$0.00"
completed_at:
- created_at: '2026-02-20T07:32:22.703Z'
- updated_at: '2026-02-20T07:32:22.703Z'
+ created_at: '2026-02-20T14:59:39.853Z'
+ updated_at: '2026-02-20T14:59:39.853Z'
order_promotions: []
line_items: []
shipments: []
@@ -806,10 +806,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R326064816
+ number: R288981797
state: cart
- token: LK9FFukgjkMKJJNvw3Ukbu6crDpwV5WqZoa
+ token: gGNB4yo3bXTXw69MbVxTvn7XJvR6LDxix7H
special_instructions:
currency: USD
item_count: 1
@@ -832,16 +832,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:32:23.809Z'
- updated_at: '2026-02-20T07:32:23.922Z'
+ created_at: '2026-02-20T14:59:40.944Z'
+ updated_at: '2026-02-20T14:59:41.159Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 27941
- slug: product-27941
+ name: Product 23898
+ slug: product-23898
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -860,23 +860,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:23.873Z'
- updated_at: '2026-02-20T07:32:23.873Z'
+ created_at: '2026-02-20T14:59:41.104Z'
+ updated_at: '2026-02-20T14:59:41.104Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_UkLWZg9DAJ
- number: H26312812665
+ number: H77830670795
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:32:23.886Z'
- updated_at: '2026-02-20T07:32:23.909Z'
+ created_at: '2026-02-20T14:59:41.121Z'
+ updated_at: '2026-02-20T14:59:41.147Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -884,7 +884,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_41
- name: Bobby Osinski
+ name: Kathi Luettgen
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -991,10 +991,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R353433317
+ number: R925578431
state: cart
- token: 56mdUdqr6kZzUj1A5ECZ1RYnCLytPvCTnCj
+ token: hzLWFutaEvZnfQmsTfX31C7VkNwyyY5jk9F
special_instructions:
currency: USD
item_count: 1
@@ -1017,16 +1017,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:32:23.954Z'
- updated_at: '2026-02-20T07:32:24.106Z'
+ created_at: '2026-02-20T14:59:41.189Z'
+ updated_at: '2026-02-20T14:59:41.322Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 35803
- slug: product-35803
+ name: Product 35049
+ slug: product-35049
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -1045,23 +1045,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:24.021Z'
- updated_at: '2026-02-20T07:32:24.021Z'
+ created_at: '2026-02-20T14:59:41.264Z'
+ updated_at: '2026-02-20T14:59:41.264Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_UkLWZg9DAJ
- number: H28446263732
+ number: H33199178299
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:32:24.052Z'
- updated_at: '2026-02-20T07:32:24.085Z'
+ created_at: '2026-02-20T14:59:41.283Z'
+ updated_at: '2026-02-20T14:59:41.309Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -1069,7 +1069,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_45
- name: Robby Mueller
+ name: Xzbdulia Oga
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -1143,21 +1143,27 @@ paths:
message: Order not found
schema:
"$ref": "#/components/schemas/ErrorResponse"
- "/api/v3/store/countries":
+ "/api/v3/store/markets/{market_id}/countries":
get:
- summary: List checkout countries
+ summary: List countries in a market
tags:
- Countries
security:
- api_key: []
- description: Returns countries available for checkout from the store checkout
- zone
+ description: Returns countries available in the market zone (for checkout address
+ dropdown)
parameters:
- name: x-spree-api-key
in: header
required: true
schema:
type: string
+ - name: market_id
+ in: path
+ required: true
+ description: Market prefixed ID (e.g., "mkt_abc123")
+ schema:
+ type: string
responses:
'200':
description: countries found
@@ -1170,15 +1176,11 @@ paths:
name: Germany
states_required: false
zipcode_required: true
- default_currency: EUR
- default_locale: de
- iso: US
iso3: USA
name: United States of America
states_required: true
zipcode_required: true
- default_currency: USD
- default_locale: en
schema:
type: object
properties:
@@ -1217,20 +1219,27 @@ paths:
message: Valid API key required
schema:
"$ref": "#/components/schemas/ErrorResponse"
- "/api/v3/store/countries/{iso}":
+ "/api/v3/store/markets/{market_id}/countries/{iso}":
get:
summary: Get a country with states
tags:
- Countries
security:
- api_key: []
- description: Returns a single country by ISO code with its states
+ description: Returns a single country by ISO code with its states (for address
+ form validation)
parameters:
- name: x-spree-api-key
in: header
required: true
schema:
type: string
+ - name: market_id
+ in: path
+ required: true
+ description: Market prefixed ID (e.g., "mkt_abc123")
+ schema:
+ type: string
- name: iso
in: path
required: true
@@ -1248,8 +1257,6 @@ paths:
name: United States of America
states_required: true
zipcode_required: true
- default_currency: USD
- default_locale: en
states:
- abbr: CA
name: California
@@ -1342,10 +1349,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R509997205
+ number: R808875817
state: cart
- token: tRaP9ZZtT1S9mWA7oPiBqNARukaZm3VLADn
+ token: 8uFyBQRQvcTTZX753pA4tGAqnapCFKVLUcM
special_instructions:
currency: USD
item_count: 1
@@ -1368,16 +1375,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:32:28.532Z'
- updated_at: '2026-02-20T07:32:28.753Z'
+ created_at: '2026-02-20T14:59:45.770Z'
+ updated_at: '2026-02-20T14:59:45.943Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 81155
- slug: product-81155
+ name: Product 89148
+ slug: product-89148
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -1396,23 +1403,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:28.643Z'
- updated_at: '2026-02-20T07:32:28.643Z'
+ created_at: '2026-02-20T14:59:45.839Z'
+ updated_at: '2026-02-20T14:59:45.839Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_UkLWZg9DAJ
- number: H97993317542
+ number: H64635866947
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:32:28.657Z'
- updated_at: '2026-02-20T07:32:28.681Z'
+ created_at: '2026-02-20T14:59:45.853Z'
+ updated_at: '2026-02-20T14:59:45.875Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -1420,7 +1427,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_65
- name: Glennie Roberts
+ name: Efren Heaney
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -1442,12 +1449,12 @@ paths:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
state: checkout
- response_code: 1-SC-20260220073228747204
- number: PYUSTV9H
+ response_code: 1-SC-20260220145945938129
+ number: P39GXJM8
amount: '50.0'
display_amount: "$50.00"
- created_at: '2026-02-20T07:32:28.752Z'
- updated_at: '2026-02-20T07:32:28.752Z'
+ created_at: '2026-02-20T14:59:45.942Z'
+ updated_at: '2026-02-20T14:59:45.942Z'
source_type: store_credit
source_id: credit_UkLWZg9DAJ
source:
@@ -1583,10 +1590,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R524620300
+ number: R659386591
state: cart
- token: GUhmwH8EcxD6eQk5vutNnVU3KwFpyJ2rmvu
+ token: ZjKri8qhBQc17kNuEVyxZqimCaGQ6dBqdTE
special_instructions:
currency: USD
item_count: 1
@@ -1609,16 +1616,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:32:30.866Z'
- updated_at: '2026-02-20T07:32:31.070Z'
+ created_at: '2026-02-20T14:59:47.903Z'
+ updated_at: '2026-02-20T14:59:48.110Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 118709
- slug: product-118709
+ name: Product 112363
+ slug: product-112363
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -1637,23 +1644,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:30.932Z'
- updated_at: '2026-02-20T07:32:31.057Z'
+ created_at: '2026-02-20T14:59:47.963Z'
+ updated_at: '2026-02-20T14:59:48.096Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_UkLWZg9DAJ
- number: H78167036332
+ number: H94589310733
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:32:30.947Z'
- updated_at: '2026-02-20T07:32:30.972Z'
+ created_at: '2026-02-20T14:59:47.977Z'
+ updated_at: '2026-02-20T14:59:48.009Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -1661,7 +1668,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_77
- name: Charise Fadel
+ name: Judy Turcotte
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -1937,10 +1944,10 @@ paths:
example:
data:
- id: or_UkLWZg9DAJ
- number: R097026037
+ number: R455524931
state: cart
- token: esbKtSsCe6nUV3RXGfDjUX4HUHLLUPz4sHy
+ token: xLjUakxTBssBiCv6PEp9XjvizyJvkoNrJVy
special_instructions:
currency: USD
item_count: 1
@@ -1963,16 +1970,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:32:35.824Z'
- updated_at: '2026-02-20T07:32:35.951Z'
+ created_at: '2026-02-20T14:59:52.951Z'
+ updated_at: '2026-02-20T14:59:53.074Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 132984
- slug: product-132984
+ name: Product 132484
+ slug: product-132484
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -1991,23 +1998,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:35.897Z'
- updated_at: '2026-02-20T07:32:35.897Z'
+ created_at: '2026-02-20T14:59:53.018Z'
+ updated_at: '2026-02-20T14:59:53.018Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_UkLWZg9DAJ
- number: H31109783878
+ number: H78437939265
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:32:35.914Z'
- updated_at: '2026-02-20T07:32:35.939Z'
+ created_at: '2026-02-20T14:59:53.034Z'
+ updated_at: '2026-02-20T14:59:53.059Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -2015,7 +2022,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_100
- name: Matilda Graham
+ name: Kellye Hand
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -2124,11 +2131,11 @@ paths:
application/json:
example:
id: cus_UkLWZg9DAJ
- first_name: Charity
- last_name: Graham
- created_at: '2026-02-20T07:32:36.982Z'
- updated_at: '2026-02-20T07:32:37.277Z'
+ first_name: Thomasena
+ last_name: Bogan
+ created_at: '2026-02-20T14:59:54.041Z'
+ updated_at: '2026-02-20T14:59:54.324Z'
addresses:
- id: addr_gbHJdmfrXB
firstname: John
@@ -2230,11 +2237,11 @@ paths:
application/json:
example:
id: cus_UkLWZg9DAJ
first_name: Updated
last_name: Name
- created_at: '2026-02-20T07:32:37.577Z'
- updated_at: '2026-02-20T07:32:37.871Z'
+ created_at: '2026-02-20T14:59:54.625Z'
+ updated_at: '2026-02-20T14:59:54.917Z'
addresses:
- id: addr_gbHJdmfrXB
firstname: John
@@ -2429,7 +2436,7 @@ paths:
example:
data:
- id: gc_UkLWZg9DAJ
- code: B1E5737A359A2737
+ code: 73575B725409C9B4
state: active
currency: USD
amount: 10.0
@@ -2443,8 +2450,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-02-20T07:32:41.540Z'
- updated_at: '2026-02-20T07:32:41.540Z'
+ created_at: '2026-02-20T14:59:58.610Z'
+ updated_at: '2026-02-20T14:59:58.610Z'
meta:
page: 1
limit: 25
@@ -2506,7 +2513,7 @@ paths:
application/json:
example:
id: gc_UkLWZg9DAJ
- code: A21AD7E85809111C
+ code: 7E5B1C6D959FC1F3
state: active
currency: USD
amount: 10.0
@@ -2520,8 +2527,8 @@ paths:
redeemed_at:
expired: false
active: true
- created_at: '2026-02-20T07:32:42.760Z'
- updated_at: '2026-02-20T07:32:42.760Z'
+ created_at: '2026-02-20T14:59:59.729Z'
+ updated_at: '2026-02-20T14:59:59.729Z'
schema:
"$ref": "#/components/schemas/StoreGiftCard"
'404':
@@ -2575,10 +2582,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R764108709
+ number: R702369330
state: cart
- token: btvpceK4LHB4Y8pXYiNkbLweRcKgrS5HQd8
+ token: diHPSTGC3vFWwGMzDnSvrKDnfGW2wEsWDeb
special_instructions:
currency: USD
item_count: 3
@@ -2601,16 +2608,16 @@ paths:
total: '49.98'
display_total: "$49.98"
completed_at:
- created_at: '2026-02-20T07:32:44.176Z'
- updated_at: '2026-02-20T07:32:44.335Z'
+ created_at: '2026-02-20T15:00:00.857Z'
+ updated_at: '2026-02-20T15:00:01.009Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 216653
- slug: product-216653
+ name: Product 219993
+ slug: product-219993
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -2629,8 +2636,8 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:44.244Z'
- updated_at: '2026-02-20T07:32:44.244Z'
+ created_at: '2026-02-20T15:00:00.930Z'
+ updated_at: '2026-02-20T15:00:00.930Z'
compare_at_amount:
thumbnail_url:
option_values: []
@@ -2639,8 +2646,8 @@ paths:
variant_id: variant_gbHJdmfrXB
quantity: 2
currency: USD
- name: Product 224097
- slug: product-224097
+ name: Product 227919
+ slug: product-227919
options_text: ''
price: '19.99'
display_price: "$19.99"
@@ -2659,8 +2666,8 @@ paths:
discounted_amount: '39.98'
display_discounted_amount: "$39.98"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:44.335Z'
- updated_at: '2026-02-20T07:32:44.335Z'
+ created_at: '2026-02-20T15:00:01.009Z'
+ updated_at: '2026-02-20T15:00:01.009Z'
compare_at_amount:
thumbnail_url:
option_values: []
@@ -2756,10 +2763,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R467057509
+ number: R359232710
state: cart
- token: 178Lv1XrciYQ5FmNbdnfTPLJshtf2DxrBTX
+ token: nHJJJ9iT2ng46rZSyCBrp1utbQca27EcXzA
special_instructions:
currency: USD
item_count: 5
@@ -2782,16 +2789,16 @@ paths:
total: '99.95'
display_total: "$99.95"
completed_at:
- created_at: '2026-02-20T07:32:46.260Z'
- updated_at: '2026-02-20T07:32:46.435Z'
+ created_at: '2026-02-20T15:00:02.979Z'
+ updated_at: '2026-02-20T15:00:03.063Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 5
currency: USD
- name: Product 255655
- slug: product-255655
+ name: Product 25919
+ slug: product-25919
options_text: ''
price: '19.99'
display_price: "$19.99"
@@ -2810,8 +2817,8 @@ paths:
discounted_amount: '99.95'
display_discounted_amount: "$99.95"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:46.392Z'
- updated_at: '2026-02-20T07:32:46.446Z'
+ created_at: '2026-02-20T15:00:03.042Z'
+ updated_at: '2026-02-20T15:00:03.073Z'
compare_at_amount:
thumbnail_url:
option_values: []
@@ -2891,10 +2898,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R823266668
+ number: R697196052
state: cart
- token: oSoKFptXApsoEDdS1pNkb1sdnx4517VBpRy
+ token: KMPdkqnCgHvQMWfY3DMWNmL5tMYR9W6p6Cr
special_instructions:
currency: USD
item_count: 0
@@ -2917,8 +2924,8 @@ paths:
total: '0.0'
display_total: "$0.00"
completed_at:
- created_at: '2026-02-20T07:32:47.039Z'
- updated_at: '2026-02-20T07:32:47.134Z'
+ created_at: '2026-02-20T15:00:03.641Z'
+ updated_at: '2026-02-20T15:00:03.737Z'
order_promotions: []
line_items: []
shipments: []
@@ -2953,6 +2960,190 @@ paths:
message: Line item not found
schema:
"$ref": "#/components/schemas/ErrorResponse"
+ "/api/v3/store/markets":
+ get:
+ summary: List all markets
+ tags:
+ - Markets
+ security:
+ - api_key: []
+ description: Returns all markets for the store with their countries. Used to
+ build country/currency switcher.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: markets found
+ content:
+ application/json:
+ example:
+ data:
+ - id: mkt_UkLWZg9DAJ
+ name: North America
+ currency: USD
+ default_locale: en
+ tax_inclusive: false
+ default: true
+ supported_locales:
+ - en
+ countries:
+ - iso: US
+ iso3: USA
+ name: United States of America
+ states_required: true
+ zipcode_required: true
+ - id: mkt_gbHJdmfrXB
+ name: Europe
+ currency: EUR
+ default_locale: de
+ tax_inclusive: false
+ default: false
+ supported_locales:
+ - de
+ countries:
+ - iso: DE
+ iso3: IS34
+ name: Germany
+ states_required: false
+ zipcode_required: true
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/StoreMarket"
+ required:
+ - data
+ '401':
+ description: unauthorized
+ content:
+ application/json:
+ example:
+ error:
+ code: invalid_token
+ message: Valid API key required
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ "/api/v3/store/markets/{id}":
+ get:
+ summary: Get a market
+ tags:
+ - Markets
+ security:
+ - api_key: []
+ description: Returns a single market by prefixed ID with its countries
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ description: Market prefixed ID (e.g., "mkt_abc123")
+ schema:
+ type: string
+ responses:
+ '200':
+ description: market found
+ content:
+ application/json:
+ example:
+ id: mkt_UkLWZg9DAJ
+ name: North America
+ currency: USD
+ default_locale: en
+ tax_inclusive: false
+ default: true
+ supported_locales:
+ - en
+ countries:
+ - iso: US
+ iso3: USA
+ name: United States of America
+ states_required: true
+ zipcode_required: true
+ schema:
+ "$ref": "#/components/schemas/StoreMarket"
+ '404':
+ description: market not found
+ content:
+ application/json:
+ example:
+ error:
+ code: record_not_found
+ message: Market not found
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ "/api/v3/store/markets/resolve":
+ get:
+ summary: Resolve market for a country
+ tags:
+ - Markets
+ security:
+ - api_key: []
+ description: Resolves which market a country belongs to. Used when customer
+ selects a country.
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: country
+ in: query
+ required: true
+ description: ISO 3166-1 alpha-2 country code (e.g., "US", "DE")
+ schema:
+ type: string
+ responses:
+ '200':
+ description: market resolved
+ content:
+ application/json:
+ example:
+ id: mkt_gbHJdmfrXB
+ name: Europe
+ currency: EUR
+ default_locale: de
+ tax_inclusive: false
+ default: false
+ supported_locales:
+ - de
+ countries:
+ - iso: DE
+ iso3: IS38
+ name: Germany
+ states_required: false
+ zipcode_required: true
+ schema:
+ "$ref": "#/components/schemas/StoreMarket"
+ '400':
+ description: missing country parameter
+ content:
+ application/json:
+ example:
+ error:
+ code: invalid_params
+ message: country parameter is required
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ '404':
+ description: country not found or no market
+ content:
+ application/json:
+ example:
+ error:
+ code: record_not_found
+ message: country not found
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
"/api/v3/store/orders/{id}":
get:
summary: Get an order
@@ -2998,9 +3189,9 @@ paths:
application/json:
example:
id: or_gbHJdmfrXB
- number: R522458782
+ number: R008040273
state: cart
- token: BgF9ip7HyAaJrbE8mDoLWuuzzTb8xbSMD9K
+ token: 7wzFBMBhZC5qGLb7DAgMGnFPENqkYxCbzym
email:
special_instructions:
currency: USD
@@ -3024,16 +3215,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:32:49.211Z'
- updated_at: '2026-02-20T07:32:49.342Z'
+ created_at: '2026-02-20T15:00:05.993Z'
+ updated_at: '2026-02-20T15:00:06.114Z'
order_promotions: []
line_items:
- id: li_gbHJdmfrXB
variant_id: variant_gbHJdmfrXB
quantity: 1
currency: USD
- name: Product 305025
- slug: product-305025
+ name: Product 309522
+ slug: product-309522
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -3052,23 +3243,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:49.286Z'
- updated_at: '2026-02-20T07:32:49.286Z'
+ created_at: '2026-02-20T15:00:06.069Z'
+ updated_at: '2026-02-20T15:00:06.069Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_gbHJdmfrXB
- number: H43779487111
+ number: H00030200861
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:32:49.301Z'
- updated_at: '2026-02-20T07:32:49.329Z'
+ created_at: '2026-02-20T15:00:06.086Z'
+ updated_at: '2026-02-20T15:00:06.104Z'
shipping_method:
id: shpm_gbHJdmfrXB
name: UPS Ground
@@ -3076,7 +3267,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_153
- name: Lowell Gleichner
+ name: Rochell Grant
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -3176,10 +3367,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R136378333
+ number: R341238186
state: cart
- token: vXcumeoWkvpQxgNVCt6RMCScTUiV6WmkxHb
+ token: mWr4SnS8VP69mSddzTWchaxGX6U6y1DUon4
special_instructions: Leave at door
currency: USD
item_count: 1
@@ -3202,16 +3393,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:32:51.837Z'
- updated_at: '2026-02-20T07:32:51.964Z'
+ created_at: '2026-02-20T15:00:08.313Z'
+ updated_at: '2026-02-20T15:00:08.449Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 331635
- slug: product-331635
+ name: Product 335395
+ slug: product-335395
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -3230,23 +3421,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:51.904Z'
- updated_at: '2026-02-20T07:32:51.904Z'
+ created_at: '2026-02-20T15:00:08.383Z'
+ updated_at: '2026-02-20T15:00:08.383Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_UkLWZg9DAJ
- number: H68261336305
+ number: H32834877408
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:32:51.919Z'
- updated_at: '2026-02-20T07:32:51.942Z'
+ created_at: '2026-02-20T15:00:08.401Z'
+ updated_at: '2026-02-20T15:00:08.428Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -3254,7 +3445,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_168
- name: Fletcher O'Keefe
+ name: Niki Boehm
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -3433,10 +3624,10 @@ paths:
application/json:
example:
id: or_gbHJdmfrXB
- number: R768975709
+ number: R587687844
state: address
- token: TTzoVi8DAM2Nysp8ySuSCSnUJqUpyNprVSL
+ token: 7Pc989BsUV6weZDHcg5Ld2anC1QVxXej6XY
special_instructions:
currency: USD
item_count: 1
@@ -3459,16 +3650,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:32:53.797Z'
- updated_at: '2026-02-20T07:32:53.983Z'
+ created_at: '2026-02-20T15:00:10.142Z'
+ updated_at: '2026-02-20T15:00:10.275Z'
order_promotions: []
line_items:
- id: li_gbHJdmfrXB
variant_id: variant_gbHJdmfrXB
quantity: 1
currency: USD
- name: Product 371656
- slug: product-371656
+ name: Product 371872
+ slug: product-371872
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -3487,23 +3678,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:53.924Z'
- updated_at: '2026-02-20T07:32:53.924Z'
+ created_at: '2026-02-20T15:00:10.218Z'
+ updated_at: '2026-02-20T15:00:10.218Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_gbHJdmfrXB
- number: H84688675590
+ number: H60949188972
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:32:53.940Z'
- updated_at: '2026-02-20T07:32:53.959Z'
+ created_at: '2026-02-20T15:00:10.234Z'
+ updated_at: '2026-02-20T15:00:10.254Z'
shipping_method:
id: shpm_gbHJdmfrXB
name: UPS Ground
@@ -3511,7 +3702,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_178
- name: Lynelle Kozey
+ name: Janine Larson
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -3613,10 +3804,10 @@ paths:
application/json:
example:
id: or_gbHJdmfrXB
- number: R906669902
+ number: R664098895
state: payment
- token: 3BPHc629n6YLJyVbQNwmFKfKJv8Hn6bFhBm
+ token: iJ5byNNPgju2F4uBfzPAmvG8hiJLXDJL1uQ
special_instructions:
currency: USD
item_count: 1
@@ -3639,16 +3830,16 @@ paths:
total: '29.99'
display_total: "$29.99"
completed_at:
- created_at: '2026-02-20T07:32:55.441Z'
- updated_at: '2026-02-20T07:32:55.713Z'
+ created_at: '2026-02-20T15:00:11.675Z'
+ updated_at: '2026-02-20T15:00:11.901Z'
order_promotions: []
line_items:
- id: li_gbHJdmfrXB
variant_id: variant_gbHJdmfrXB
quantity: 1
currency: USD
- name: Product 406497
- slug: product-406497
+ name: Product 405201
+ slug: product-405201
options_text: ''
price: '19.99'
display_price: "$19.99"
@@ -3667,23 +3858,23 @@ paths:
discounted_amount: '19.99'
display_discounted_amount: "$19.99"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:55.504Z'
- updated_at: '2026-02-20T07:32:55.636Z'
+ created_at: '2026-02-20T15:00:11.737Z'
+ updated_at: '2026-02-20T15:00:11.812Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_EfhxLZ9ck8
- number: H05801897844
+ number: H48610513576
state: pending
tracking:
tracking_url:
cost: '10.0'
display_cost: "$10.00"
shipped_at:
- created_at: '2026-02-20T07:32:55.659Z'
- updated_at: '2026-02-20T07:32:55.682Z'
+ created_at: '2026-02-20T15:00:11.832Z'
+ updated_at: '2026-02-20T15:00:11.857Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -3691,7 +3882,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_188
- name: Bette Streich
+ name: Riley Kemmer
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -3792,10 +3983,10 @@ paths:
application/json:
example:
id: or_gbHJdmfrXB
- number: R351951063
+ number: R187908927
state: complete
- token: iXBbpPcUScZibXBniRvxGraVaATptaUwj1M
+ token: a4ZbxD3eKjQ8zq7YTyBbeKurucyrdFS9Zgv
special_instructions:
currency: USD
item_count: 1
@@ -3817,17 +4008,17 @@ paths:
display_additional_tax_total: "$0.00"
total: '29.99'
display_total: "$29.99"
- completed_at: '2026-02-20T07:32:56.855Z'
- created_at: '2026-02-20T07:32:56.424Z'
- updated_at: '2026-02-20T07:32:56.855Z'
+ completed_at: '2026-02-20T15:00:13.004Z'
+ created_at: '2026-02-20T15:00:12.602Z'
+ updated_at: '2026-02-20T15:00:13.004Z'
order_promotions: []
line_items:
- id: li_gbHJdmfrXB
variant_id: variant_gbHJdmfrXB
quantity: 1
currency: USD
- name: Product 42880
- slug: product-42880
+ name: Product 428216
+ slug: product-428216
options_text: ''
price: '19.99'
display_price: "$19.99"
@@ -3846,23 +4037,23 @@ paths:
discounted_amount: '19.99'
display_discounted_amount: "$19.99"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:32:56.489Z'
- updated_at: '2026-02-20T07:32:56.842Z'
+ created_at: '2026-02-20T15:00:12.741Z'
+ updated_at: '2026-02-20T15:00:12.998Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_EfhxLZ9ck8
- number: H77179292367
+ number: H66615954280
state: pending
tracking:
tracking_url:
cost: '10.0'
display_cost: "$10.00"
shipped_at:
- created_at: '2026-02-20T07:32:56.681Z'
- updated_at: '2026-02-20T07:32:56.822Z'
+ created_at: '2026-02-20T15:00:12.857Z'
+ updated_at: '2026-02-20T15:00:12.979Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -3870,7 +4061,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_194
- name: Karima Kerluke
+ name: Deja Herman
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -3903,11 +4094,11 @@ paths:
payment_method_id: pm_UkLWZg9DAJ
state: checkout
response_code: '12345'
- number: P879EUIB
+ number: PJN5JEKP
amount: '29.99'
display_amount: "$29.99"
- created_at: '2026-02-20T07:32:56.783Z'
- updated_at: '2026-02-20T07:32:56.783Z'
+ created_at: '2026-02-20T15:00:12.945Z'
+ updated_at: '2026-02-20T15:00:12.945Z'
source_type: credit_card
source_id: card_UkLWZg9DAJ
source:
@@ -4101,13 +4292,13 @@ paths:
id: ps_gbHJdmfrXB
status: pending
currency: USD
- external_id: bogus_6ee29f9efba90844bb1674ef
+ external_id: bogus_bdbcecc6c06bce2262d89b07
external_data:
- client_secret: bogus_secret_d683df6e81a4cfaf
+ client_secret: bogus_secret_a7a26e8478170f06
customer_external_id:
expires_at:
- created_at: '2026-02-20T07:33:00.064Z'
- updated_at: '2026-02-20T07:33:00.064Z'
+ created_at: '2026-02-20T15:00:16.017Z'
+ updated_at: '2026-02-20T15:00:16.017Z'
amount: '110.0'
payment_method_id: pm_UkLWZg9DAJ
order_id: or_UkLWZg9DAJ
@@ -4198,13 +4389,13 @@ paths:
id: ps_UkLWZg9DAJ
status: pending
currency: USD
- external_id: bogus_1161ae08b0c9ae90e3521ae5
+ external_id: bogus_9ca684c4df117cd62c2edf1b
external_data:
client_secret: secret_123
customer_external_id:
expires_at:
- created_at: '2026-02-20T07:33:01.556Z'
- updated_at: '2026-02-20T07:33:01.556Z'
+ created_at: '2026-02-20T15:00:17.399Z'
+ updated_at: '2026-02-20T15:00:17.399Z'
amount: '110.0'
payment_method_id: pm_UkLWZg9DAJ
order_id: or_UkLWZg9DAJ
@@ -4245,13 +4436,13 @@ paths:
id: ps_UkLWZg9DAJ
status: pending
currency: USD
- external_id: bogus_5e84bc85119c9b5090515899
+ external_id: bogus_7cda5f2950b12b9cad6ed584
external_data:
client_secret: secret_123
customer_external_id:
expires_at:
- created_at: '2026-02-20T07:33:02.962Z'
- updated_at: '2026-02-20T07:33:02.975Z'
+ created_at: '2026-02-20T15:00:18.961Z'
+ updated_at: '2026-02-20T15:00:18.975Z'
amount: '50.0'
payment_method_id: pm_UkLWZg9DAJ
order_id: or_UkLWZg9DAJ
@@ -4326,13 +4517,13 @@ paths:
id: ps_UkLWZg9DAJ
status: completed
currency: USD
- external_id: bogus_5bf3d37c36986d2fce987947
+ external_id: bogus_18c8d4a81f670bcacd2e311d
external_data:
client_secret: secret_123
customer_external_id:
expires_at:
- created_at: '2026-02-20T07:33:03.662Z'
- updated_at: '2026-02-20T07:33:03.674Z'
+ created_at: '2026-02-20T15:00:19.649Z'
+ updated_at: '2026-02-20T15:00:19.668Z'
amount: '110.0'
payment_method_id: pm_UkLWZg9DAJ
order_id: or_UkLWZg9DAJ
@@ -4396,11 +4587,11 @@ paths:
example:
id: pss_gbHJdmfrXB
status: pending
- external_id: bogus_seti_8e21195d3ecc0674a438b244
- external_client_secret: bogus_seti_secret_50e6ffecd89f38f8
+ external_id: bogus_seti_6c492d9230d6597a0b97bc2c
+ external_client_secret: bogus_seti_secret_aaa9591470c19c29
external_data: {}
- created_at: '2026-02-20T07:33:04.981Z'
- updated_at: '2026-02-20T07:33:04.981Z'
+ created_at: '2026-02-20T15:00:21.187Z'
+ updated_at: '2026-02-20T15:00:21.187Z'
payment_method_id: pm_UkLWZg9DAJ
payment_source_id:
payment_source_type:
@@ -4483,12 +4674,12 @@ paths:
example:
id: pss_UkLWZg9DAJ
status: pending
- external_id: seti_test_45b2dc95e294b9abe28db8e0
- external_client_secret: seti_secret_097cef4afe896d07944e0f83
+ external_id: seti_test_5660f0595798a57764015c7d
+ external_client_secret: seti_secret_593e5dfa54e5724e4f015795
external_data:
client_secret: secret_123
- created_at: '2026-02-20T07:33:06.691Z'
- updated_at: '2026-02-20T07:33:06.691Z'
+ created_at: '2026-02-20T15:00:22.895Z'
+ updated_at: '2026-02-20T15:00:22.895Z'
payment_method_id: pm_UkLWZg9DAJ
payment_source_id:
payment_source_type:
@@ -4547,12 +4738,12 @@ paths:
example:
id: pss_UkLWZg9DAJ
status: completed
- external_id: seti_test_c79bb2e9bf1e4f9c845a9a91
- external_client_secret: seti_secret_2dabf34c6e481213808cc9f1
+ external_id: seti_test_5ebdb96fb5df0969b2329220
+ external_client_secret: seti_secret_1812a6b13515139d100a5d35
external_data:
client_secret: secret_123
- created_at: '2026-02-20T07:33:07.852Z'
- updated_at: '2026-02-20T07:33:07.866Z'
+ created_at: '2026-02-20T15:00:24.038Z'
+ updated_at: '2026-02-20T15:00:24.054Z'
payment_method_id: pm_UkLWZg9DAJ
payment_source_id: card_UkLWZg9DAJ
payment_source_type: Spree::CreditCard
@@ -4621,11 +4812,11 @@ paths:
payment_method_id: pm_UkLWZg9DAJ
state: checkout
response_code: '12345'
- number: PUJ6WY52
+ number: P3GO1JVZ
amount: '110.0'
display_amount: "$110.00"
- created_at: '2026-02-20T07:33:09.259Z'
- updated_at: '2026-02-20T07:33:09.259Z'
+ created_at: '2026-02-20T15:00:25.402Z'
+ updated_at: '2026-02-20T15:00:25.402Z'
source_type: credit_card
source_id: card_UkLWZg9DAJ
source:
@@ -4705,11 +4896,11 @@ paths:
payment_method_id: pm_UkLWZg9DAJ
state: checkout
response_code: '12345'
- number: P4BTCODM
+ number: PJU2R95Z
amount: '110.0'
display_amount: "$110.00"
- created_at: '2026-02-20T07:33:10.715Z'
- updated_at: '2026-02-20T07:33:10.715Z'
+ created_at: '2026-02-20T15:00:26.818Z'
+ updated_at: '2026-02-20T15:00:26.818Z'
source_type: credit_card
source_id: card_UkLWZg9DAJ
source:
@@ -4793,17 +4984,19 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 595378
+ name: Product 593922
description: |-
- Ad culpa ullam laborum quaerat quam. Consectetur impedit odio unde iure aspernatur in officia. Exercitationem sunt dolores aperiam fuga impedit magni sapiente aut.
- Accusamus perspiciatis fugit sunt sapiente nesciunt incidunt corporis. Inventore reiciendis pariatur sed esse. Error fugit nulla accusantium est.
- slug: product-595378
+ Soluta ratione unde laborum adipisci placeat aliquid est eaque. Maiores eaque officiis fugit quod modi doloribus ratione. Ab neque eos eveniet consequuntur ipsa doloribus minus ea. Dignissimos fuga corporis aut ab. Fuga culpa voluptates sed non provident quisquam.
+ Enim fuga praesentium atque autem. Earum autem doloremque delectus voluptate molestiae dolorem veniam. Asperiores nemo iusto sed delectus error. In hic minus assumenda facere porro commodi iusto ex.
+ Aliquam modi sit harum blanditiis occaecati repellat. Delectus id quis sequi dicta. Quaerat similique repudiandae ut inventore.
+ Aspernatur repudiandae consequatur iure asperiores iste exercitationem laudantium expedita. Optio minus enim eligendi delectus. Saepe beatae exercitationem quas corrupti assumenda maxime ipsum deleniti. Nisi ad officia explicabo aspernatur tempora alias.
+ slug: product-593922
meta_description:
meta_keywords:
variant_count: 1
- available_on: '2025-02-20T07:33:11.504Z'
- created_at: '2026-02-20T07:33:11.522Z'
- updated_at: '2026-02-20T07:33:11.636Z'
+ available_on: '2025-02-20T15:00:27.586Z'
+ created_at: '2026-02-20T15:00:27.604Z'
+ updated_at: '2026-02-20T15:00:27.791Z'
purchasable: true
in_stock: false
backorderable: true
@@ -4823,19 +5016,20 @@ paths:
price_list_id:
original_price:
- id: prod_gbHJdmfrXB
- name: Product 602187
+ name: Product 608816
description: |-
- Eveniet ea similique eum omnis nam provident excepturi. Temporibus inventore odit reiciendis itaque aut minima autem. Laborum tempore ducimus quaerat itaque corrupti recusandae ratione debitis.
- Praesentium aliquam tempore ut eligendi reiciendis quos. Dicta eveniet labore libero tempora suscipit. Maxime voluptatem sapiente cum ipsum nihil ab.
- Fugiat recusandae deserunt occaecati voluptatem aspernatur. Saepe repellat hic eos dolores. Dolorum eos fuga accusantium reprehenderit aspernatur. Ad doloremque sapiente voluptate commodi non labore asperiores nostrum. Sit error dicta suscipit reiciendis totam eius dolor soluta.
- Accusantium culpa quas amet magnam neque similique accusamus. Sapiente praesentium assumenda quis ducimus. Consequatur perspiciatis hic omnis suscipit ad ea. Earum minima consequatur enim ex laborum.
- slug: product-602187
+ Quidem corporis distinctio aspernatur reiciendis esse quod soluta. Alias maiores pariatur veritatis architecto dolorem. Inventore iusto fugiat quaerat quo debitis assumenda exercitationem.
+ Quaerat perferendis deserunt quibusdam deleniti aliquam. Aut quas illo numquam sunt dolor saepe consequatur exercitationem. Modi fuga et dolorem libero asperiores voluptatum quibusdam dolor.
+ Numquam quia sapiente assumenda sint cumque sunt aut. Debitis dolorum repudiandae corrupti praesentium laboriosam facilis veritatis sequi. Qui consectetur saepe facilis id possimus magnam.
+ Aperiam modi aspernatur quod fuga repellat debitis. Asperiores a similique facere nihil suscipit saepe cumque reprehenderit. Ullam voluptatem sed perferendis fuga maxime.
+ Deserunt repudiandae optio temporibus perspiciatis similique architecto. Tempora delectus magnam quisquam reprehenderit laboriosam harum. Illum in perspiciatis quam adipisci eius non. Perspiciatis quibusdam cumque aliquam facilis natus. Dignissimos sed impedit quos doloribus iusto cum ipsa maxime.
+ slug: product-608816
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-02-20T07:33:11.659Z'
- created_at: '2026-02-20T07:33:11.673Z'
- updated_at: '2026-02-20T07:33:11.717Z'
+ available_on: '2025-02-20T15:00:27.815Z'
+ created_at: '2026-02-20T15:00:27.828Z'
+ updated_at: '2026-02-20T15:00:27.854Z'
purchasable: true
in_stock: false
backorderable: true
@@ -4920,20 +5114,18 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 714238
+ name: Product 715447
description: |-
- Non placeat minus iste voluptatum ipsam totam repellat enim. Illo accusamus ipsa voluptatem ab mollitia suscipit reiciendis. Labore vel cupiditate sit inventore aliquam reprehenderit eveniet.
- Eligendi a libero voluptas amet quibusdam quod nihil. Ullam explicabo doloremque facere at et. Esse facilis dignissimos ad nihil.
- Earum recusandae in aspernatur veritatis cum facere. Maiores corporis doloribus ad neque repellendus possimus. Quae non sunt voluptas harum qui molestias tenetur. Velit dolore ab autem beatae. Amet nisi itaque iste incidunt accusamus pariatur minus.
- Inventore dolorum ipsa ullam ut quo modi recusandae deleniti. Eligendi ipsa quis inventore ullam. Provident facilis impedit esse consequuntur delectus amet. Dolores exercitationem commodi aperiam quae ad itaque sapiente. Iure nihil delectus nemo quod repudiandae temporibus.
- Veniam quisquam sint sapiente fugit quibusdam nostrum eos. Cupiditate totam molestias eius provident odio quibusdam saepe. Exercitationem recusandae sequi temporibus expedita veritatis voluptatem.
- slug: product-714238
+ Tenetur architecto facere libero non eligendi nam nobis. Odit fugiat asperiores cumque quos. Maxime occaecati quam omnis cupiditate sunt quibusdam inventore id. Quos molestias perferendis illum unde vitae. Eligendi voluptatem expedita aperiam sunt provident.
+ Est odit eaque sunt nesciunt quas. Labore aperiam mollitia et dolore officia. Voluptates impedit numquam quis deserunt optio soluta.
+ Animi qui odit doloremque dolores illum numquam. Consectetur repellendus porro reiciendis eius beatae. Suscipit inventore aliquid reiciendis odio.
+ slug: product-715447
meta_description:
meta_keywords:
variant_count: 1
- available_on: '2025-02-20T07:33:13.052Z'
- created_at: '2026-02-20T07:33:13.067Z'
- updated_at: '2026-02-20T07:33:13.151Z'
+ available_on: '2025-02-20T15:00:29.151Z'
+ created_at: '2026-02-20T15:00:29.168Z'
+ updated_at: '2026-02-20T15:00:29.259Z'
purchasable: true
in_stock: false
backorderable: true
@@ -5138,15 +5330,15 @@ paths:
example:
data:
- id: ship_UkLWZg9DAJ
- number: H12995030510
+ number: H74499216409
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:33:17.203Z'
- updated_at: '2026-02-20T07:33:17.227Z'
+ created_at: '2026-02-20T15:00:33.345Z'
+ updated_at: '2026-02-20T15:00:33.374Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -5154,7 +5346,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_280
- name: Homer Harvey
+ name: Rudolf Bins
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -5251,15 +5443,15 @@ paths:
application/json:
example:
id: ship_UkLWZg9DAJ
- number: H40866827654
+ number: H37071494625
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:33:18.747Z'
- updated_at: '2026-02-20T07:33:18.771Z'
+ created_at: '2026-02-20T15:00:34.707Z'
+ updated_at: '2026-02-20T15:00:34.735Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -5267,7 +5459,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_288
- name: Melany Friesen
+ name: Asa Kiehn
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -5340,10 +5532,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R517782580
+ number: R502443473
state: delivery
- token: vj6uhzMhRZ8ZkZs6gi8fJRCRDCqtCjdsK1E
+ token: dkHLk6CA7dJCqFGbCrN8ccbU7ZCTAowCncE
special_instructions:
currency: USD
item_count: 1
@@ -5366,16 +5558,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:33:20.160Z'
- updated_at: '2026-02-20T07:33:20.297Z'
+ created_at: '2026-02-20T15:00:35.987Z'
+ updated_at: '2026-02-20T15:00:36.124Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 1036323
- slug: product-1036323
+ name: Product 1033455
+ slug: product-1033455
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -5394,23 +5586,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:33:20.226Z'
- updated_at: '2026-02-20T07:33:20.226Z'
+ created_at: '2026-02-20T15:00:36.061Z'
+ updated_at: '2026-02-20T15:00:36.061Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_UkLWZg9DAJ
- number: H64667949376
+ number: H54377042243
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:33:20.241Z'
- updated_at: '2026-02-20T07:33:20.292Z'
+ created_at: '2026-02-20T15:00:36.077Z'
+ updated_at: '2026-02-20T15:00:36.123Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -5418,7 +5610,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_296
- name: Milly Bahringer
+ name: Keneth Nolan
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -5531,10 +5723,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R266644698
+ number: R604832972
state: cart
- token: nDXpeWB4NMkFHEXCuw9JQwZj2ZLbVFNNgeo
+ token: ALRorHZLWJRAUTVuWuUBcBR4VDbZNqksJJJ
special_instructions:
currency: USD
item_count: 1
@@ -5557,16 +5749,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:33:21.837Z'
- updated_at: '2026-02-20T07:33:22.439Z'
+ created_at: '2026-02-20T15:00:37.461Z'
+ updated_at: '2026-02-20T15:00:37.985Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 1058331
- slug: product-1058331
+ name: Product 1056123
+ slug: product-1056123
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -5585,23 +5777,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:33:22.023Z'
- updated_at: '2026-02-20T07:33:22.023Z'
+ created_at: '2026-02-20T15:00:37.526Z'
+ updated_at: '2026-02-20T15:00:37.526Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_UkLWZg9DAJ
- number: H51749846982
+ number: H20558347011
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:33:22.042Z'
- updated_at: '2026-02-20T07:33:22.077Z'
+ created_at: '2026-02-20T15:00:37.541Z'
+ updated_at: '2026-02-20T15:00:37.566Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -5609,7 +5801,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_304
- name: Leroy Beahan
+ name: Rosalie Wiegand
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -5631,12 +5823,12 @@ paths:
- id: py_UkLWZg9DAJ
payment_method_id: pm_UkLWZg9DAJ
state: checkout
- response_code: 1-SC-20260220073322431393
- number: PFKU5RRY
+ response_code: 1-SC-20260220150037980223
+ number: P6QD1ZWH
amount: '10.0'
display_amount: "$10.00"
- created_at: '2026-02-20T07:33:22.439Z'
- updated_at: '2026-02-20T07:33:22.439Z'
+ created_at: '2026-02-20T15:00:37.985Z'
+ updated_at: '2026-02-20T15:00:37.985Z'
source_type: store_credit
source_id: credit_UkLWZg9DAJ
source:
@@ -5750,10 +5942,10 @@ paths:
application/json:
example:
id: or_UkLWZg9DAJ
- number: R268164819
+ number: R946574670
state: cart
- token: rBMKkiSumqN6HMNR7Q8dyYMXePBYRYsmtiM
+ token: xHDETjBJjTqoF6gLDcXZNMd1qYgWScnRGmR
special_instructions:
currency: USD
item_count: 1
@@ -5776,16 +5968,16 @@ paths:
total: '110.0'
display_total: "$110.00"
completed_at:
- created_at: '2026-02-20T07:33:23.878Z'
- updated_at: '2026-02-20T07:33:24.022Z'
+ created_at: '2026-02-20T15:00:39.281Z'
+ updated_at: '2026-02-20T15:00:39.408Z'
order_promotions: []
line_items:
- id: li_UkLWZg9DAJ
variant_id: variant_UkLWZg9DAJ
quantity: 1
currency: USD
- name: Product 1071294
- slug: product-1071294
+ name: Product 1075877
+ slug: product-1075877
options_text: ''
price: '10.0'
display_price: "$10.00"
@@ -5804,23 +5996,23 @@ paths:
discounted_amount: '10.0'
display_discounted_amount: "$10.00"
display_compare_at_amount: "$0.00"
- created_at: '2026-02-20T07:33:23.964Z'
- updated_at: '2026-02-20T07:33:23.964Z'
+ created_at: '2026-02-20T15:00:39.355Z'
+ updated_at: '2026-02-20T15:00:39.355Z'
compare_at_amount:
thumbnail_url:
option_values: []
digital_links: []
shipments:
- id: ship_UkLWZg9DAJ
- number: H42554101730
+ number: H22387213561
state: pending
tracking: U10000
tracking_url:
cost: '100.0'
display_cost: "$100.00"
shipped_at:
- created_at: '2026-02-20T07:33:23.981Z'
- updated_at: '2026-02-20T07:33:24.008Z'
+ created_at: '2026-02-20T15:00:39.371Z'
+ updated_at: '2026-02-20T15:00:39.396Z'
shipping_method:
id: shpm_UkLWZg9DAJ
name: UPS Ground
@@ -5828,7 +6020,7 @@ paths:
stock_location:
id: sloc_UkLWZg9DAJ
state_abbr: STATE_ABBR_312
- name: Maryetta Hirthe
+ name: Alison Volkman
address1: 1600 Pennsylvania Ave NW
city: Washington
zipcode: '20500'
@@ -5916,8 +6108,8 @@ paths:
instagram: spreecommerce
customer_support_email: [email protected]
default_locale: en
- created_at: '2026-02-20T07:32:12.731Z'
- updated_at: '2026-02-20T07:32:12.840Z'
+ created_at: '2026-02-20T14:59:29.860Z'
+ updated_at: '2026-02-20T14:59:29.968Z'
default_country_iso: US
supported_currencies:
- USD
@@ -5982,32 +6174,32 @@ paths:
- id: txnmy_UkLWZg9DAJ
name: Categories
position: 1
- created_at: '2026-02-20T07:32:12.739Z'
- updated_at: '2026-02-20T07:32:12.761Z'
+ created_at: '2026-02-20T14:59:29.869Z'
+ updated_at: '2026-02-20T14:59:29.889Z'
root_id: txn_UkLWZg9DAJ
- id: txnmy_gbHJdmfrXB
name: Brands
position: 2
- created_at: '2026-02-20T07:32:12.762Z'
- updated_at: '2026-02-20T07:32:12.770Z'
+ created_at: '2026-02-20T14:59:29.890Z'
+ updated_at: '2026-02-20T14:59:29.899Z'
root_id: txn_gbHJdmfrXB
- id: txnmy_EfhxLZ9ck8
name: Collections
position: 3
- created_at: '2026-02-20T07:32:12.771Z'
- updated_at: '2026-02-20T07:32:12.842Z'
+ created_at: '2026-02-20T14:59:29.901Z'
+ updated_at: '2026-02-20T14:59:29.971Z'
root_id: txn_EfhxLZ9ck8
- id: txnmy_VqXmZF31wY
name: taxonomy_11
position: 4
- created_at: '2026-02-20T07:33:24.076Z'
- updated_at: '2026-02-20T07:33:24.089Z'
+ created_at: '2026-02-20T15:00:39.458Z'
+ updated_at: '2026-02-20T15:00:39.467Z'
root_id: txn_OIJLhNcSbf
- id: txnmy_uw2YK1rnl0
name: taxonomy_12
position: 5
- created_at: '2026-02-20T07:33:24.090Z'
- updated_at: '2026-02-20T07:33:24.098Z'
+ created_at: '2026-02-20T15:00:39.468Z'
+ updated_at: '2026-02-20T15:00:39.476Z'
root_id: txn_AXs1igzRC6
meta:
page: 1
@@ -6073,8 +6265,8 @@ paths:
id: txnmy_VqXmZF31wY
name: taxonomy_17
position: 4
- created_at: '2026-02-20T07:33:24.414Z'
- updated_at: '2026-02-20T07:33:24.425Z'
+ created_at: '2026-02-20T15:00:39.743Z'
+ updated_at: '2026-02-20T15:00:39.751Z'
root_id: txn_OIJLhNcSbf
schema:
"$ref": "#/components/schemas/StoreTaxonomy"
@@ -6135,8 +6327,8 @@ paths:
meta_description:
meta_keywords:
children_count: 0
- created_at: '2026-02-20T07:32:12.751Z'
- updated_at: '2026-02-20T07:32:12.760Z'
+ created_at: '2026-02-20T14:59:29.880Z'
+ updated_at: '2026-02-20T14:59:29.887Z'
parent_id:
taxonomy_id: txnmy_UkLWZg9DAJ
description: ''
@@ -6155,8 +6347,8 @@ paths:
meta_description:
meta_keywords:
children_count: 0
- created_at: '2026-02-20T07:32:12.765Z'
- updated_at: '2026-02-20T07:32:12.769Z'
+ created_at: '2026-02-20T14:59:29.893Z'
+ updated_at: '2026-02-20T14:59:29.897Z'
parent_id:
taxonomy_id: txnmy_gbHJdmfrXB
description: ''
@@ -6175,8 +6367,8 @@ paths:
meta_description:
meta_keywords:
children_count: 2
- created_at: '2026-02-20T07:32:12.774Z'
- updated_at: '2026-02-20T07:32:12.842Z'
+ created_at: '2026-02-20T14:59:29.904Z'
+ updated_at: '2026-02-20T14:59:29.971Z'
parent_id:
taxonomy_id: txnmy_EfhxLZ9ck8
description: ''
@@ -6195,8 +6387,8 @@ paths:
meta_description:
meta_keywords:
children_count: 0
- created_at: '2026-02-20T07:32:12.786Z'
- updated_at: '2026-02-20T07:32:12.788Z'
+ created_at: '2026-02-20T14:59:29.915Z'
+ updated_at: '2026-02-20T14:59:29.917Z'
parent_id: txn_EfhxLZ9ck8
taxonomy_id: txnmy_EfhxLZ9ck8
description: ''
@@ -6215,8 +6407,8 @@ paths:
meta_description:
meta_keywords:
children_count: 0
- created_at: '2026-02-20T07:32:12.800Z'
- updated_at: '2026-02-20T07:32:12.802Z'
+ created_at: '2026-02-20T14:59:29.927Z'
+ updated_at: '2026-02-20T14:59:29.928Z'
parent_id: txn_EfhxLZ9ck8
taxonomy_id: txnmy_EfhxLZ9ck8
description: ''
@@ -6235,8 +6427,8 @@ paths:
meta_description:
meta_keywords:
children_count: 1
- created_at: '2026-02-20T07:33:25.185Z'
- updated_at: '2026-02-20T07:33:25.242Z'
+ created_at: '2026-02-20T15:00:40.184Z'
+ updated_at: '2026-02-20T15:00:40.244Z'
parent_id:
taxonomy_id: txnmy_VqXmZF31wY
description: ''
@@ -6255,8 +6447,8 @@ paths:
meta_description:
meta_keywords:
children_count: 1
- created_at: '2026-02-20T07:33:25.196Z'
- updated_at: '2026-02-20T07:33:25.242Z'
+ created_at: '2026-02-20T15:00:40.190Z'
+ updated_at: '2026-02-20T15:00:40.243Z'
parent_id: txn_OIJLhNcSbf
taxonomy_id: txnmy_VqXmZF31wY
description: ''
@@ -6275,8 +6467,8 @@ paths:
meta_description:
meta_keywords:
children_count: 0
- created_at: '2026-02-20T07:33:25.207Z'
- updated_at: '2026-02-20T07:33:25.214Z'
+ created_at: '2026-02-20T15:00:40.200Z'
+ updated_at: '2026-02-20T15:00:40.207Z'
parent_id: txn_AXs1igzRC6
taxonomy_id: txnmy_VqXmZF31wY
description: ''
@@ -6357,8 +6549,8 @@ paths:
meta_description:
meta_keywords:
children_count: 1
- created_at: '2026-02-20T07:33:25.996Z'
- updated_at: '2026-02-20T07:33:26.052Z'
+ created_at: '2026-02-20T15:00:41.015Z'
+ updated_at: '2026-02-20T15:00:41.054Z'
parent_id: txn_OIJLhNcSbf
taxonomy_id: txnmy_VqXmZF31wY
description: ''
@@ -6429,19 +6621,19 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 1158544
- description: |-
- Hic aliquam cum at earum. Aspernatur illum ratione iste ea facere nam ullam eveniet. Non ducimus atque iste cumque. Magnam sit expedita dignissimos dicta necessitatibus assumenda aliquid.
- Est nobis eum porro suscipit nihil dolorum iste beatae. Neque nulla odit est quo reiciendis. Recusandae laborum perspiciatis sunt officiis molestiae.
- Consectetur earum consequatur possimus autem omnis excepturi fugiat. Eligendi debitis ducimus occaecati a odio eius doloremque voluptate. Molestiae eveniet optio neque iste occaecati quaerat veritatis dolorem. Enim quaerat dignissimos consequuntur accusamus. Non eos adipisci nam delectus recusandae aspernatur.
- Ipsa maxime culpa ad suscipit. Tempora magni veniam saepe neque ea. Aperiam amet aut blanditiis inventore earum distinctio occaecati. Debitis voluptatem voluptates harum sequi. Veniam cumque autem numquam aut sit ea officia libero.
- slug: product-1158544
+ name: Product 1152940
+ description: Excepturi id dolores animi atque vero ipsam eius. Hic
+ officiis dolorum perferendis provident amet eum. Labore corrupti
+ nisi nemo vero excepturi dolor cupiditate. Ipsam tempore itaque
+ quo tempora repellendus placeat. Iste sequi voluptate inventore
+ ullam.
+ slug: product-1152940
meta_description:
meta_keywords:
variant_count: 0
- available_on: '2025-02-20T07:33:27.116Z'
- created_at: '2026-02-20T07:33:27.133Z'
- updated_at: '2026-02-20T07:33:27.179Z'
+ available_on: '2025-02-20T15:00:42.137Z'
+ created_at: '2026-02-20T15:00:42.153Z'
+ updated_at: '2026-02-20T15:00:42.179Z'
purchasable: true
in_stock: false
backorderable: true
@@ -6538,9 +6730,9 @@ paths:
data:
- id: wl_UkLWZg9DAJ
name: My Wishlist
- token: HC5Q3EgjJXi53Rya8BAfZyFd
- created_at: '2026-02-20T07:33:28.499Z'
- updated_at: '2026-02-20T07:33:28.499Z'
+ token: FfRVg5DN1LBEMa9Vo41WYjFK
+ created_at: '2026-02-20T15:00:43.357Z'
+ updated_at: '2026-02-20T15:00:43.357Z'
is_default: false
is_private: true
meta:
@@ -6599,9 +6791,9 @@ paths:
example:
id: wl_gbHJdmfrXB
name: Birthday Ideas
- token: VPMuCChPdP58SqEfQGmW7Wtp
- created_at: '2026-02-20T07:33:30.022Z'
- updated_at: '2026-02-20T07:33:30.022Z'
+ token: Cv9suGkd4JtN7awMoUFx9cz7
+ created_at: '2026-02-20T15:00:44.718Z'
+ updated_at: '2026-02-20T15:00:44.718Z'
is_default: false
is_private: true
schema:
@@ -6674,9 +6866,9 @@ paths:
example:
id: wl_UkLWZg9DAJ
name: My Wishlist
- token: gcbqf98pYVXzx68RmFHubg8E
- created_at: '2026-02-20T07:33:31.405Z'
- updated_at: '2026-02-20T07:33:31.405Z'
+ token: jAbbQqGE4wL7hBptZTrVweug
+ created_at: '2026-02-20T15:00:45.905Z'
+ updated_at: '2026-02-20T15:00:45.905Z'
is_default: false
is_private: true
schema:
@@ -6722,9 +6914,9 @@ paths:
example:
id: wl_UkLWZg9DAJ
name: Updated Name
- token: 1Q5WqZi7XPxAvhDXRVqG83J1
- created_at: '2026-02-20T07:33:32.874Z'
- updated_at: '2026-02-20T07:33:32.994Z'
+ token: x5Sdr1z5RwZvbWurVCuTjqS8
+ created_at: '2026-02-20T15:00:47.229Z'
+ updated_at: '2026-02-20T15:00:47.343Z'
is_default: false
is_private: true
schema:
@@ -6805,8 +6997,8 @@ paths:
variant_id: variant_gbHJdmfrXB
wishlist_id: wl_UkLWZg9DAJ
quantity: 1
- created_at: '2026-02-20T07:33:34.471Z'
- updated_at: '2026-02-20T07:33:34.471Z'
+ created_at: '2026-02-20T15:00:48.669Z'
+ updated_at: '2026-02-20T15:00:48.669Z'
variant:
id: variant_gbHJdmfrXB
product_id: prod_gbHJdmfrXB
@@ -6815,8 +7007,8 @@ paths:
options_text: ''
track_inventory: true
image_count: 0
- created_at: '2026-02-20T07:33:34.423Z'
- updated_at: '2026-02-20T07:33:34.446Z'
+ created_at: '2026-02-20T15:00:48.622Z'
+ updated_at: '2026-02-20T15:00:48.646Z'
thumbnail:
purchasable: true
in_stock: false
@@ -6907,8 +7099,10 @@ tags:
description: Product catalog browsing
- name: Taxons
description: Taxonomies and categories
+- name: Markets
+ description: Markets (region + currency + locale bundles) and market resolution
- name: Countries
- description: Available shipping countries
+ description: Countries within a market zone
- name: Cart
description: Shopping cart management
- name: Checkout
@@ -6925,6 +7119,7 @@ x-tagGroups:
- name: Store
tags:
- Store
+ - Markets
- Countries
- name: Catalog
tags:
@@ -7773,12 +7968,6 @@ components:
type: boolean
zipcode_required:
type: boolean
- default_currency:
- type: string
- nullable: true
- default_locale:
- type: string
- nullable: true
states:
type: array
items:
@@ -7789,8 +7978,6 @@ components:
- name
- states_required
- zipcode_required
- - default_currency
- - default_locale
x-typelizer: true
StoreCreditCard:
type: object
@@ -8109,6 +8296,39 @@ components:
- option_values
- digital_links
x-typelizer: true
+ StoreMarket:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ currency:
+ type: string
+ default_locale:
+ type: string
+ tax_inclusive:
+ type: boolean
+ default:
+ type: boolean
+ supported_locales:
+ type: array
+ items:
+ type: string
+ countries:
+ type: array
+ items:
+ "$ref": "#/components/schemas/StoreCountry"
+ required:
+ - id
+ - name
+ - currency
+ - default_locale
+ - tax_inclusive
+ - default
+ - supported_locales
+ - countries
+ x-typelizer: true
StoreMetafield:
type: object
properties:
diff --git a/packages/next/CHANGELOG.md b/packages/next/CHANGELOG.md
index 7afd07adca..f55d5a74d0 100644
--- a/packages/next/CHANGELOG.md
+++ b/packages/next/CHANGELOG.md
@@ -1,5 +1,19 @@
# @spree/next
+## 0.4.0
+
+### Minor Changes
+
+- **Breaking:** Replace country functions with market functions to match @spree/sdk 0.4.0 Markets API
+ - `listCountries()` / `getCountry()` removed
+ - New `listMarkets()` — list all markets with nested countries (for country/currency switcher)
+ - New `getMarket(id)` — get a single market
+ - New `resolveMarket(countryIso)` — resolve country to market
+ - New `listMarketCountries(marketId)` — list countries in a market (for checkout address forms)
+ - New `getMarketCountry(marketId, iso)` — get a country with states (for address validation)
+- Re-export `StoreMarket` type from `@spree/sdk`
+- Bump `@spree/sdk` peer dependency to `>=0.4.0`
+
## 0.3.1
### Patch Changes
diff --git a/packages/next/package.json b/packages/next/package.json
index 4f294d386e..6b20311abb 100644
--- a/packages/next/package.json
+++ b/packages/next/package.json
@@ -1,6 +1,6 @@
{
"name": "@spree/next",
- "version": "0.3.1",
+ "version": "0.4.0",
"description": "Next.js integration for Spree Commerce — server actions, caching, and cookie-based auth",
"type": "module",
"main": "./dist/index.js",
@@ -55,7 +55,7 @@
"url": "https://github.com/spree/spree/issues"
},
"peerDependencies": {
- "@spree/sdk": ">=0.3.0",
+ "@spree/sdk": ">=0.4.0",
"next": ">=15.0.0",
"react": ">=19.0.0"
},
diff --git a/packages/next/src/data/countries.ts b/packages/next/src/data/countries.ts
deleted file mode 100644
index 4d68e38ab2..0000000000
--- a/packages/next/src/data/countries.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import type { StoreCountry } from '@spree/sdk';
-import { getClient } from '../config';
-import type { SpreeNextOptions } from '../types';
-
-/**
- * List all available countries.
- */
-export async function listCountries(
- options?: SpreeNextOptions
-): Promise<{ data: StoreCountry[] }> {
- return getClient().store.countries.list({
- locale: options?.locale,
- currency: options?.currency,
- });
-}
-
-/**
- * Get a single country by ISO code.
- */
-export async function getCountry(
- iso: string,
- options?: SpreeNextOptions
-): Promise<StoreCountry> {
- return getClient().store.countries.get(iso, {
- locale: options?.locale,
- currency: options?.currency,
- });
-}
diff --git a/packages/next/src/data/markets.ts b/packages/next/src/data/markets.ts
new file mode 100644
index 0000000000..3541772ed1
--- /dev/null
+++ b/packages/next/src/data/markets.ts
@@ -0,0 +1,70 @@
+import type { StoreMarket, StoreCountry } from '@spree/sdk';
+import { getClient } from '../config';
+import type { SpreeNextOptions } from '../types';
+
+/**
+ * List all markets with their countries.
+ * Used to build a country/currency switcher.
+ */
+export async function listMarkets(
+ options?: SpreeNextOptions
+): Promise<{ data: StoreMarket[] }> {
+ return getClient().store.markets.list({
+ locale: options?.locale,
+ currency: options?.currency,
+ });
+}
+
+/**
+ * Get a single market by prefixed ID.
+ */
+export async function getMarket(
+ id: string,
+ options?: SpreeNextOptions
+): Promise<StoreMarket> {
+ return getClient().store.markets.get(id, {
+ locale: options?.locale,
+ currency: options?.currency,
+ });
+}
+
+/**
+ * Resolve which market a country belongs to.
+ * @param countryIso - ISO 3166-1 alpha-2 code (e.g., "US", "DE")
+ */
+export async function resolveMarket(
+ countryIso: string,
+ options?: SpreeNextOptions
+): Promise<StoreMarket> {
+ return getClient().store.markets.resolve(countryIso, {
+ locale: options?.locale,
+ currency: options?.currency,
+ });
+}
+
+/**
+ * List countries in a market's zone (for checkout address forms).
+ */
+export async function listMarketCountries(
+ marketId: string,
+ options?: SpreeNextOptions
+): Promise<{ data: StoreCountry[] }> {
+ return getClient().store.markets.countries.list(marketId, {
+ locale: options?.locale,
+ currency: options?.currency,
+ });
+}
+
+/**
+ * Get a country by ISO code with states (for address form validation).
+ */
+export async function getMarketCountry(
+ marketId: string,
+ iso: string,
+ options?: SpreeNextOptions
+): Promise<StoreCountry> {
+ return getClient().store.markets.countries.get(marketId, iso, {
+ locale: options?.locale,
+ currency: options?.currency,
+ });
+}
diff --git a/packages/next/src/index.ts b/packages/next/src/index.ts
index 05813d3d16..27145fa200 100644
--- a/packages/next/src/index.ts
+++ b/packages/next/src/index.ts
@@ -7,7 +7,7 @@ export { listProducts, getProduct, getProductFilters } from './data/products';
export { listTaxons, getTaxon, listTaxonProducts } from './data/taxons';
export { listTaxonomies, getTaxonomy } from './data/taxonomies';
export { getStore } from './data/store';
-export { listCountries, getCountry } from './data/countries';
+export { listMarkets, getMarket, resolveMarket, listMarketCountries, getMarketCountry } from './data/markets';
// Server actions (mutations + auth-dependent reads)
export {
@@ -74,6 +74,7 @@ export type {
StoreTaxon,
StoreTaxonomy,
StoreCountry,
+ StoreMarket,
StoreStore,
StoreAddress,
StoreCustomer,
diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md
index 20526ab6b3..52795f4f43 100644
--- a/packages/sdk/CHANGELOG.md
+++ b/packages/sdk/CHANGELOG.md
@@ -1,5 +1,19 @@
# @spree/sdk
+## 0.4.0
+
+### Minor Changes
+
+- **Breaking:** Replace `store.countries` with `store.markets` — Markets bundle geography (zone), currency, and locale into a single entity for multi-region commerce
+ - `store.countries.list()` → `store.markets.countries.list(marketId)` (countries are now scoped to a market)
+ - `store.countries.get(iso)` → `store.markets.countries.get(marketId, iso)`
+ - New `store.markets.list()` — list all markets with nested countries (for country/currency switcher)
+ - New `store.markets.get(id)` — get a single market by prefixed ID
+ - New `store.markets.resolve(countryIso)` — resolve which market a country belongs to
+- Add `country` option to `RequestOptions` — sends `X-Spree-Country` header for automatic market resolution (currency, locale, tax zone)
+- Add `StoreMarket` type and `StoreMarketSchema` Zod schema
+- **Breaking:** Remove `default_currency` and `default_locale` from `StoreCountry` type and Zod schema (these were misleading ISO3166 values, not store config)
+
## 0.3.1
### Patch Changes
diff --git a/packages/sdk/package.json b/packages/sdk/package.json
index 380bd380c4..0f7db3890c 100644
--- a/packages/sdk/package.json
+++ b/packages/sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@spree/sdk",
- "version": "0.3.1",
+ "version": "0.4.0",
"description": "Official TypeScript SDK for Spree Commerce API",
"type": "module",
"main": "./dist/index.cjs",
diff --git a/packages/sdk/src/request.ts b/packages/sdk/src/request.ts
index 7f8e44d695..0b0f8a4c6b 100644
--- a/packages/sdk/src/request.ts
+++ b/packages/sdk/src/request.ts
@@ -22,6 +22,8 @@ export interface RequestOptions {
locale?: string;
/** Currency for prices (e.g., 'USD', 'EUR') */
currency?: string;
+ /** Country ISO code for market resolution (e.g., 'US', 'DE') */
+ country?: string;
/** Custom headers */
headers?: Record<string, string>;
}
@@ -98,7 +100,7 @@ export function createRequestFn(
path: string,
options: InternalRequestOptions = {}
): Promise<T> {
- const { token, orderToken, locale, currency, headers = {}, body, params } = options;
+ const { token, orderToken, locale, currency, country, headers = {}, body, params } = options;
// Build URL with query params
const url = new URL(`${config.baseUrl}${basePath}${path}`);
@@ -140,6 +142,10 @@ export function createRequestFn(
requestHeaders['x-spree-currency'] = currency;
}
+ if (country) {
+ requestHeaders['x-spree-country'] = country;
+ }
+
const maxAttempts = config.retryConfig ? config.retryConfig.maxRetries + 1 : 1;
for (let attempt = 0; attempt < maxAttempts; attempt++) {
diff --git a/packages/sdk/src/store-client.ts b/packages/sdk/src/store-client.ts
index 01528f8934..2a57b633e8 100644
--- a/packages/sdk/src/store-client.ts
+++ b/packages/sdk/src/store-client.ts
@@ -24,6 +24,7 @@ import type {
StoreProduct,
StoreOrder,
StoreCountry,
+ StoreMarket,
StoreTaxonomy,
StoreTaxon,
StorePayment,
@@ -207,23 +208,71 @@ export class StoreClient {
};
// ============================================
- // Geography
+ // Markets & Geography
// ============================================
- readonly countries = {
+ readonly markets = {
/**
- * List countries available for checkout
- * Returns countries from the store's checkout zone without states
+ * List all markets with their countries
+ * Used to build a country/currency switcher on the frontend
*/
- list: (options?: RequestOptions): Promise<{ data: StoreCountry[] }> =>
- this.request<{ data: StoreCountry[] }>('GET', '/countries', options),
+ list: (options?: RequestOptions): Promise<{ data: StoreMarket[] }> =>
+ this.request<{ data: StoreMarket[] }>('GET', '/markets', options),
/**
- * Get a country by ISO code with states
- * @param iso - ISO 3166-1 alpha-2 code (e.g., "US", "DE")
+ * Get a single market by prefixed ID
+ * @param id - Market prefixed ID (e.g., "mkt_abc123")
*/
- get: (iso: string, options?: RequestOptions): Promise<StoreCountry> =>
- this.request<StoreCountry>('GET', `/countries/${iso}`, options),
+ get: (id: string, options?: RequestOptions): Promise<StoreMarket> =>
+ this.request<StoreMarket>('GET', `/markets/${id}`, options),
+
+ /**
+ * Resolve which market a country belongs to
+ * @param countryIso - ISO 3166-1 alpha-2 code (e.g., "US", "DE")
+ */
+ resolve: (
+ countryIso: string,
+ options?: RequestOptions
+ ): Promise<StoreMarket> =>
+ this.request<StoreMarket>('GET', '/markets/resolve', {
+ ...options,
+ params: { country: countryIso },
+ }),
+
+ /**
+ * Nested resource: Countries within a market (for checkout address forms)
+ */
+ countries: {
+ /**
+ * List countries in a market's zone
+ * @param marketId - Market prefixed ID (e.g., "mkt_abc123")
+ */
+ list: (
+ marketId: string,
+ options?: RequestOptions
+ ): Promise<{ data: StoreCountry[] }> =>
+ this.request<{ data: StoreCountry[] }>(
+ 'GET',
+ `/markets/${marketId}/countries`,
+ options
+ ),
+
+ /**
+ * Get a country by ISO code with states (for address form validation)
+ * @param marketId - Market prefixed ID (e.g., "mkt_abc123")
+ * @param iso - ISO 3166-1 alpha-2 code (e.g., "US", "DE")
+ */
+ get: (
+ marketId: string,
+ iso: string,
+ options?: RequestOptions
+ ): Promise<StoreCountry> =>
+ this.request<StoreCountry>(
+ 'GET',
+ `/markets/${marketId}/countries/${iso}`,
+ options
+ ),
+ },
};
// ============================================
diff --git a/packages/sdk/src/types/generated/StoreCountry.ts b/packages/sdk/src/types/generated/StoreCountry.ts
index 804b72783b..5a7d963b1c 100644
--- a/packages/sdk/src/types/generated/StoreCountry.ts
+++ b/packages/sdk/src/types/generated/StoreCountry.ts
@@ -1,4 +1,4 @@
-// Typelizer digest b7b8e848a3995e816dedab81e1bf9aa9
+// Typelizer digest 9cec9b196b3857ffdab3e40ffd0ad55b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {StoreState} from '@/types'
@@ -9,8 +9,6 @@ type StoreCountry = {
name: string;
states_required: boolean;
zipcode_required: boolean;
- default_currency: string | null;
- default_locale: string | null;
states?: Array<StoreState>;
}
diff --git a/packages/sdk/src/types/generated/StoreMarket.ts b/packages/sdk/src/types/generated/StoreMarket.ts
new file mode 100644
index 0000000000..5c009ee44f
--- /dev/null
+++ b/packages/sdk/src/types/generated/StoreMarket.ts
@@ -0,0 +1,17 @@
+// Typelizer digest 20481a2c126447a1ac656a125edb9145
+//
+// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {StoreCountry} from '@/types'
+
+type StoreMarket = {
+ id: string;
+ name: string;
+ currency: string;
+ default_locale: string;
+ tax_inclusive: boolean;
+ default: boolean;
+ supported_locales: Array<string>;
+ countries: Array<StoreCountry>;
+}
+
+export default StoreMarket;
diff --git a/packages/sdk/src/types/generated/index.ts b/packages/sdk/src/types/generated/index.ts
index 2706cb90a3..9308e82ce1 100644
--- a/packages/sdk/src/types/generated/index.ts
+++ b/packages/sdk/src/types/generated/index.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 02681b7b8bb8bc18318caf3b95a267d0
+// Typelizer digest 1643aed7c6e7e519a529b750155272d4
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
export type { default as StoreAddress } from './StoreAddress'
@@ -18,6 +18,7 @@ export type { default as StoreDigitalLink } from './StoreDigitalLink'
export type { default as StoreGiftCard } from './StoreGiftCard'
export type { default as StoreImage } from './StoreImage'
export type { default as StoreLineItem } from './StoreLineItem'
+export type { default as StoreMarket } from './StoreMarket'
export type { default as StoreMetafield } from './StoreMetafield'
export type { default as StoreOptionType } from './StoreOptionType'
export type { default as StoreOptionValue } from './StoreOptionValue'
diff --git a/packages/sdk/src/zod/generated/StoreCountry.ts b/packages/sdk/src/zod/generated/StoreCountry.ts
index d7dbd57ce5..941f3cee2c 100644
--- a/packages/sdk/src/zod/generated/StoreCountry.ts
+++ b/packages/sdk/src/zod/generated/StoreCountry.ts
@@ -8,8 +8,6 @@ export const StoreCountrySchema = z.object({
name: z.string(),
states_required: z.boolean(),
zipcode_required: z.boolean(),
- default_currency: z.string().nullable(),
- default_locale: z.string().nullable(),
states: z.array(StoreStateSchema).optional(),
});
diff --git a/packages/sdk/src/zod/generated/StoreMarket.ts b/packages/sdk/src/zod/generated/StoreMarket.ts
new file mode 100644
index 0000000000..8ed48b3040
--- /dev/null
+++ b/packages/sdk/src/zod/generated/StoreMarket.ts
@@ -0,0 +1,16 @@
+// This file is auto-generated. Do not edit directly.
+import { z } from 'zod';
+import { StoreCountrySchema } from './StoreCountry';
+
+export const StoreMarketSchema = z.object({
+ id: z.string(),
+ name: z.string(),
+ currency: z.string(),
+ default_locale: z.string(),
+ tax_inclusive: z.boolean(),
+ default: z.boolean(),
+ supported_locales: z.array(z.string()),
+ countries: z.array(StoreCountrySchema),
+});
+
+export type StoreMarket = z.infer<typeof StoreMarketSchema>;
diff --git a/packages/sdk/src/zod/generated/index.ts b/packages/sdk/src/zod/generated/index.ts
index 7e70b8762a..858d333620 100644
--- a/packages/sdk/src/zod/generated/index.ts
+++ b/packages/sdk/src/zod/generated/index.ts
@@ -16,6 +16,7 @@ export { StoreDigitalLinkSchema, type StoreDigitalLink } from './StoreDigitalLin
export { StoreGiftCardSchema, type StoreGiftCard } from './StoreGiftCard';
export { StoreImageSchema, type StoreImage } from './StoreImage';
export { StoreLineItemSchema, type StoreLineItem } from './StoreLineItem';
+export { StoreMarketSchema, type StoreMarket } from './StoreMarket';
export { StoreMetafieldSchema, type StoreMetafield } from './StoreMetafield';
export { StoreOptionTypeSchema, type StoreOptionType } from './StoreOptionType';
export { StoreOptionValueSchema, type StoreOptionValue } from './StoreOptionValue';