Magento Store Configuration — Websites, Store Views and Scope
In this tutorial, you'll learn Magento store configuration: the website-store-storeview hierarchy, scope concept and inheritance chain, creating multiple websites and stores, store views for multi-language sites, domain per store, and configuration scope management.
What You'll Learn
- The website-store-storeview hierarchy and how it maps to URLs
- Creating websites, stores, and store views in the admin
- Scope concept: Global, Website, Store, Store View
- Configuration inheritance and overriding at lower levels
- Setting store code in URL and using domain per store
- Managing price scope and attribute scope per website
- Using configuration inheritance for efficient multi-store management
Why It Matters
Most e-commerce businesses serve multiple markets. A single Magento installation can power multiple brands, multiple languages, and multiple currencies. Understanding scope and the website-store-storeview hierarchy is essential for configuring multi-store setups. Misconfiguring scope leads to wrong prices in one country, incorrect tax rates, or product details showing in the wrong language. Getting scope right means one backend, one codebase, and many storefronts.
Real-World Use
A sportswear brand runs three stores from one Magento installation: US store (English, USD), UK store (English, GBP), and EU store (French, German, Italian, EUR). Each store has its own domain, currency, tax rules, and shipping methods. Products are shared across all stores but some products are restricted per country. Admins use scoped configuration to set USD prices for the US store and EUR prices for the EU store, while system-wide settings like the admin URL remain global.
Learning Path
flowchart LR A["Customer Groups"] --> B["Store Configuration
You are here"]:::current B --> C["Catalog Management"] C --> D["Content Management"] classDef current fill:#38bdf8,color:#0f172a,stroke-width:2px
The Hierarchy
Magento's store structure has four levels. Understanding these levels is the foundation of store configuration.
Global (System-wide)
└── Website (e.g., US Store, UK Store)
└── Store (e.g., Default Store)
└── Store View (e.g., English, French, German)
Global: Settings at the global level apply to all websites, stores, and store views. Examples: admin URL, encryption key, system configuration.
Website: A website is a top-level entity that can have its own domain, currency, customer accounts, and product catalog. Each website can have multiple stores and store views. Customers and orders are isolated per website.
Store: A store is a child of a website. It has its own root category (the top-level category in the navigation menu). Stores within the same website share the same customer accounts and currency but can have different product selections.
Store View: A store view is typically used for languages. Each store view can have its own locale, translated content, and URL. Products are shared across store views, but translations and some attributes can be different per store view.
Let's look at a real configuration:
Website: US (domain: us.example.com)
├── Store: Default Store (root category: US Catalog)
│ ├── Store View: English (URL: us.example.com/en/)
│ └── Store View: Spanish (URL: us.example.com/es/)
Website: EU (domain: eu.example.com)
├── Store: Default Store (root category: EU Catalog)
│ ├── Store View: English (URL: eu.example.com/en/)
│ ├── Store View: French (URL: eu.example.com/fr/)
│ └── Store View: German (URL: eu.example.com/de/)
Website: UK (domain: uk.example.com)
└── Store: Default Store (root category: UK Catalog)
└── Store View: English (URL: uk.example.com/)
Creating Websites
To create a new website:
- Go to Stores > Settings > All Stores.
- Click Create Website.
- Configure:
Name: US Store
Code: us_store
Sort Order: 0
The Code is used in URL configuration and PHP code. Keep it short and use lowercase with underscores.
After creating a website, the store_website table records it:
SELECT * FROM store_website;
Output:
website_id | code | name | default_group_id | is_default
0 | admin | Admin | 0 | 0
1 | base | Main Website | 1 | 1
2 | us_store | US Store | 0 | 0
Creating Stores
Within each website, create a store:
- Go to Stores > Settings > All Stores.
- Click Create Store.
- Configure:
Store Name: US Store
Code: us_store
Website: US Store
Root Category: Default Category (or a custom root category per store)
Is Active: Yes
The Root Category determines which products appear in the top navigation. Each store can have its own root category, letting you show different product catalogs per store.
Creating Store Views
Store views represent language or presentation variants:
- Go to Stores > Settings > All Stores.
- Click Create Store View.
- Configure:
Store View Name: English
Code: english
Store: US Store
Status: Enabled
Sort Order: 10
Create a second view for Spanish:
Store View Name: Spanish
Code: spanish
Store: US Store
Status: Enabled
Sort Order: 20
Each store view can have its own:
- Locale (language, date format, currency)
- Configuration settings (if scoped to store view)
- CMS pages and blocks (per store view)
- Product attribute values (if scoped to store view)
- Email templates (translated per language)
Scope Concept
Scope determines which level a configuration setting applies to. Here is how scope works for different configuration types.
Configuration scope (Stores > Configuration):
| Setting Level | Example | Affects |
|---|---|---|
| Global | Encryption key, admin URL | All websites |
| Website | Base URL, currency, tax rates | One website and all its stores |
| Store | Root category | One store and all its views |
| Store View | Locale, language-specific settings | One store view only |
When you set a value at a higher scope, all lower scopes inherit it by default. You can override at any lower level.
For example, to set the store name:
Stores > Configuration > General > General
> Store Name
// Scope: Store View
// Set "My US Store" for English view
// Set "Mi Tienda US" for Spanish view
Scope Inheritance Chain
When Magento reads a configuration value, it walks this chain:
Store View value (if set) → Store value (if set) → Website value (if set) → Global value (if set) → Default value
If you set "Store Name" at the website level, all store views under that website inherit it. If you set it at the store view level, that specific view uses it instead.
Visual Scope Indicator
In admin, when you edit configuration, the scope is shown at the top left. A checkbox labeled Use Default or Use Website appears depending on scope. If the checkbox is checked, the value is inherited from the higher scope. Uncheck it to override.
Store Code in URL
You can tell Magento to include the store code in the URL:
Stores > Configuration > General > Web
> Url Options
> Add Store Code to Urls: Yes
When enabled, URLs look like:
http://example.com/default/catalog/product/view/id/123
http://example.com/french/catalog/product/view/id/123
For multi-store setups, this is not recommended. Use domain per store instead.
Domain Per Store
The recommended approach for multi-store is to assign a separate domain or subdomain to each website.
Configure base URLs for each website:
Scope: US Store Website
Stores > Configuration > General > Web
> Base URLs
> Base URL: http://us.example.com/
> Base Link URL: {{unsecure_base_url}}
> Base URLs (Secure)
> Base URL: https://us.example.com/
> Use Secure URLs on Storefront: Yes
Scope: UK Store Website
Stores > Configuration > General > Web
> Base URLs
> Base URL: http://uk.example.com/
Then use environment variables or the nginx.conf / .htaccess to map domains to store codes.
For Apache, add to .htaccess:
SetEnvIf Host us\.example\.com MAGE_RUN_CODE=us_store
SetEnvIf Host us\.example\.com MAGE_RUN_TYPE=website
SetEnvIf Host uk\.example\.com MAGE_RUN_CODE=uk_store
SetEnvIf Host uk\.example\.com MAGE_RUN_TYPE=website
For Nginx:
map $http_host $MAGE_RUN_CODE {
us.example.com us_store;
uk.example.com uk_store;
}
map $http_host $MAGE_RUN_TYPE {
us.example.com website;
uk.example.com website;
}
server {
# ...
fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE;
fastcgi_param MAGE_RUN_TYPE $MAGE_RUN_TYPE;
}
This approach gives each store its own clean domain without URL prefixes.
Store-Specific Pricing
By default, product prices are global. Change this so each website has its own prices:
Stores > Configuration > Catalog > Catalog
> Price
> Catalog Price Scope: Website
When set to Website, you can enter different prices per product per website from the product edit page.
This affects the price attribute scope. The price is no longer a single value but stored per website in the catalog_product_entity_decimal table.
Attribute Scope
Product attributes can have three scopes:
| Scope | Behavior |
|---|---|
| Global | Same value across all websites and store views |
| Website | Different value per website, same across store views within that website |
| Store View | Different value per store view (used for translations) |
Configure attribute scope when creating or editing an attribute:
Stores > Attributes > Product
> Edit Attribute
> Advanced Attribute Properties
> Scope: Store View
Typical scope assignments:
- Global: SKU, weight, manufacturer part number
- Website: Price, special price, stock status
- Store View: Name, description, meta data (for translations)
The scope setting affects the EAV storage tables. A store-view-scoped attribute stores values in catalog_product_entity_varchar with a store_id column.
Configuration Inheritance in Practice
Here is a step-by-step example of managing tax configuration across multiple stores.
Global scope: Set the default country to US. Website scope: For the UK website, override the default country to GB. Website scope: For the EU website, override the default country to DE. Store View scope: For the French store view, set the locale to French.
The UK website inherits "tax calculation based on shipping address" from global, but uses GB as the default country. Each store view under the UK website uses the English locale unless overridden.
This inheritance system saves hours of repetitive configuration. You set common values once at the highest scope and only override what differs.
Common Mistakes
Creating multiple websites when stores would suffice. Websites isolate customer accounts, orders, and catalogs. If customers should share accounts and products across brands, use stores within one website instead. Only create new websites when you need separate customer databases.
Forgetting to set the store code in URL or domain mapping. After creating store views, visitors see the default store unless you configure URL-based or domain-based store detection. Without this, accessing the Spanish URL may still show the English store.
Not clearing cache after scope changes. Configuration changes at any scope are cached. Always run
bin/magento cache:flushafter updating store settings. Without clearing, edits appear to have no effect.Ignoring the root category per store. Each store uses a root category as the top-level navigation. If you do not assign a custom root category for each store, they all show the same product tree. Create separate root categories for stores with different product selections.
Setting prices at global scope when multi-currency is needed. If you sell in USD and GBP but keep price scope at Global, both websites share the same numeric price. A product costing $100 in the US would also show as $100 on the UK site instead of the appropriate GBP price.
Practice Questions
What is the difference between a website and a store in Magento's hierarchy? Answer: A website is the highest level, with its own domain, currency, and customer database. A store is a child of a website and has its own root category and navigation. Multiple stores under the same website share customer accounts and currency.
How does scope inheritance work when Magento reads a configuration value? Answer: Magento walks the chain from specific to general: Store View → Store → Website → Global → Default. If a value is set at the Store View level, it is used. If not, Magento checks the Store level, then Website, then Global, and finally uses the hardcoded default.
What is the purpose of the root category in relation to stores? Answer: The root category determines which categories and products appear in the navigation menu for a store. Each store can have its own root category, allowing different product catalogs per store even within the same website.
Challenge: Set up a three-store Magento installation for a single brand selling in the US, UK, and Japan. Create the websites (us_website, uk_website, jp_website), stores with appropriate root categories, and store views (US English, UK English, Japanese). Configure domain routing with Nginx
mapblocks using store codes. Set price scope to Website and enter sample prices for three test products in each currency (USD, GBP, JPY). Configure tax rules per website with different VAT rates. Write a Magento PHP script that reads the current store from theMagento\Store\Model\StoreManagerInterfaceand prints the website code, store code, and store view code. Verify that a MySQL query shows distinct prices per website incatalog_product_entity_decimal.
FAQ
Mini Project
Your task: Configure a complete multi-store Magento installation for a home goods retailer expanding from the US into Canada and Germany.
- Create the website/store/storeview structure:
- Website: us_website → Store: us_store → Store Views: English
- Website: ca_website → Store: ca_store → Store Views: English, French
- Website: de_website → Store: de_store → Store Views: German
- Create separate root categories for each store: "US Home Goods", "Canada Home Goods", "Deutsche Haushaltswaren".
- Set store code in URLs to No and configure domain routing instead:
- us.example.com → us_website
- ca.example.com → ca_website
- de.example.com → de_website
- Set price scope to Website.
- Configure base currency per website: USD, CAD, EUR.
- Create a test product "Premium Towel Set" priced at:
- US: $24.99
- Canada: $32.99 CAD
- Germany: 19.99 EUR
- Set the default country per website.
- Configure shipping methods: US stores get USPS, Canada stores get Canada Post, Germany stores get DHL.
- Run
bin/magento cache:flushand verify each store loads with the correct domain, currency, language, and products. - Write a script that uses
Magento\Store\Model\StoreManagerInterface::getStores()to list all stores and their configuration.
What's Next
Now that you understand store configuration and scope, learn how to manage the product catalog at scale:
Continue to Lesson 18: Catalog Management — Import/export, CSV, bulk operations.
Related lessons:
- Categories and Attributes — Attribute scope per store view
- Pricing and Catalog Rules — Website-scoped catalog rules
- Multi-Store — Advanced multi-store setup and maintenance
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro