Spree::Storemodel 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,
- Store B,
- Store C,
All parts of Spree (API v1, API v2, Storefront, Admin Panel) have this implemented. This method is also available in views and JSON serializers.
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 in
Admin Panel -> Configurations -> Storeor via Rails console:
To get the default store in your code or rails console type:
Each Store can have multiple locales and currencies. This configuration is stored in Store model attributes:
default_currency- this is the default currency that will be pre-selected when visiting the store the first time, eg.
supported_currencies- if there is more than one supported currency, visitors will be able to choose which currency they would like to browse your store in, eg.
default_locale- this is the default locale/language which will be pre-selected when visiting the store the first time, eg.
supported_locales, if there is more than one supported locale, visitors will be able to choose which locale they would like to browse your store in, eg.
fr, etc. Locales are available upon installing Spree I18n
As of version 4.6, the
Storeresource allows for translating many of its fields. Translations are enabled when selecting more than one locale in
supported_locales. The following fields are translatable:
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.