Skip to main content

Overview

The Spree::Store model is the center of the Spree ecosystem.

Store Model Diagram

Key relationships:
  • Store is the central model - all commerce data is scoped to a store
  • Each store has one or more Markets that define geographic selling regions with their own currency and locale
  • Each store has its own Orders, Products, Payment Methods, and Shipping Methods
  • Stores can have different currencies, locales, and configurations
  • Content (Menus, CMS Pages) and Webhooks are also store-specific

Store attributes

AttributeDescriptionExample Value
nameThe name of the store, typically displayed in the browser title bar and throughout the site.Spree Demo Site
codeA unique code to identify the store.spree-001
meta_descriptionA brief description of the store for SEO purposes.An exclusive selection of high-quality products.
meta_keywordsRelevant keywords associated with the store for SEO.fashion, electronics, books
seo_titleA custom SEO title for the store.Shop the Best Deals Online - Spree Store
mail_from_addressThe email address used for sending emails from the store.noreply@example.com
defaultIndicates if the store is the default store.true
customer_support_emailThe email address for customer support inquiries.support@example.com
facebookThe store’s Facebook page URL.spree
twitterThe store’s Twitter handle.@spreecommerce
instagramThe store’s Instagram profile URL.https://www.instagram.com/spree
descriptionA detailed description of the store.Your one-stop shop for everything you need.
addressThe physical address of the store.123 Example St, San Francisco, CA
contact_phoneThe contact phone number for the store.+1 234-567-8900
new_order_notifications_emailThe email address to send notifications of new orders.orders@example.com

Accessing Store in code

To access the current store you can use current_store in controllers or Spree::Store.current in models/services/jobs.

Markets

Markets let you segment your store into geographic regions, each with its own currency, locale, and set of countries. For example, a single store can have:
  • North America — USD, English, ships to US and Canada
  • Europe — EUR, German, ships to DE, FR, AT, NL
  • United Kingdom — GBP, English, ships to GB
For full details on creating and managing markets, see the Markets guide.

Store resources

Each Store can have its own resources. For example, a Store can have its own Products, Taxonomies, Promotions, etc.
ResourceRelationship
MarketOne Store has many Markets, each defining a geographic region with its own currency and locale
OrderOne Order belongs to one Store
ProductOne Product can be associated with many Store(s), you can pick and choose in which Store(s) each Product will be available
Payment MethodOne Payment Method can be associated with many Store(s), you can select in which Stores given Payment Method will be available on Checkout
TaxonomyOne Taxonomy belongs to one Store
PromotionOne Promotion can be associated with multiple Stores
Store CreditOne Store Credit belongs to and can be used in one Store

Multi-store setup

To enable multiple stores please follow our Multi Store guide