Overview
TheSpree::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
| Attribute | Description | Example Value |
|---|---|---|
name | The name of the store, typically displayed in the browser title bar and throughout the site. | Spree Demo Site |
code | A unique code to identify the store. | spree-001 |
meta_description | A brief description of the store for SEO purposes. | An exclusive selection of high-quality products. |
meta_keywords | Relevant keywords associated with the store for SEO. | fashion, electronics, books |
seo_title | A custom SEO title for the store. | Shop the Best Deals Online - Spree Store |
mail_from_address | The email address used for sending emails from the store. | noreply@example.com |
default | Indicates if the store is the default store. | true |
customer_support_email | The email address for customer support inquiries. | support@example.com |
facebook | The store’s Facebook page URL. | spree |
twitter | The store’s Twitter handle. | @spreecommerce |
instagram | The store’s Instagram profile URL. | https://www.instagram.com/spree |
description | A detailed description of the store. | Your one-stop shop for everything you need. |
address | The physical address of the store. | 123 Example St, San Francisco, CA |
contact_phone | The contact phone number for the store. | +1 234-567-8900 |
new_order_notifications_email | The email address to send notifications of new orders. | orders@example.com |
Accessing Store in code
To access the current store you can usecurrent_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
Store resources
Each Store can have its own resources. For example, a Store can have its own Products, Taxonomies, Promotions, etc.| Resource | Relationship |
|---|---|
| Market | One Store has many Markets, each defining a geographic region with its own currency and locale |
| Order | One Order belongs to one Store |
| Product | One Product can be associated with many Store(s), you can pick and choose in which Store(s) each Product will be available |
| Payment Method | One Payment Method can be associated with many Store(s), you can select in which Stores given Payment Method will be available on Checkout |
| Taxonomy | One Taxonomy belongs to one Store |
| Promotion | One Promotion can be associated with multiple Stores |
| Store Credit | One Store Credit belongs to and can be used in one Store |

