Overview
TheSpree::Store model is the center of the Spree ecosystem. Each Spree installation can have multiple Stores. Each Store operates on a different domain or subdomain, eg.
- Store A,
us.example.com - Store B,
eu.example.com - Store C,
another-brand.com

Spree multi-store setup
Store attributes
Current Store
Spree will try to determine the current store based on the current URL. If the URL does not match any of the stores in the database, Spree will fall back to the default store. All Spree controllers or any other controllers that include Spree::Core::ControllerHelpers::Store have access to thecurrent_store method which returns the Store matching the current URL.
All parts of Spree (API v1, API v2, Storefront, Admin Panel) have this implemented. This method is also available in views and JSON serializers.
Under the hood in
current_store calls Spree::Stores::FindCurrent.new(url: url).execute.This logic can be easily overwritten by settingconfig/initializers/spree.rb fileDefault Store
If the system cannot find any Store that matches the current URL it will fall back to the Default Store. You can set the default Store inAdmin Panel -> Configurations -> Store or via Rails console:
Localization and Currency
Each Store can have multiple locales and currencies. This configuration is stored in Store model attributes:Translations
As of version 4.6, theStore resource allows for translating many of its fields. Translations are enabled when selecting more than one locale in supported_locales. The following fields are translatable:
namemeta_descriptionmeta_keywordsseo_titlefacebooktwitterinstagramcustomer_support_emaildescriptionaddresscontact_phonenew_order_notifications_email
Checkout configuration
Each Store can be configured to ship to only selected countries. This is achieved via thecheckout_zone_id attribute which holds the ID of the selected Zone record.
Available Shipping Methods on the Checkout are determined based on the Zone and Shipping Methods configuration.
This will also have an effect on what Shipping / Billing Addresses user can add/ select during Checkout. Only Addresses from Countries or States available in the selected Zone can be used and will be visible in the User’s Address Book.

