Store Configuration in Magento 2
The default configurations for your store are stored in a config.xml for the appropriate module. When you change settings in the Commerce Admin or the CLI bin/magento config:set command, the changes are reflected in the core database, specifically the core_config_data table. These settings overwrite the default configurations stored in the config.xml file.
Store settings, which refer to the configurations in theAdmin Stores > Settings > Configuration section, are stored in the deployment configuration files based on the type of configuration:
- app/etc/config.php—configuration settings for stores, websites, modules or extensions, static file optimization, and system values related to static content deployment. See the config.php reference in the Configuration Guide.
- app/etc/env.php—values for system-specific overrides and sensitive settings that should NOT be stored in source control. See the env.php reference in the Configuration Guide.
Scope Specification in Store configuration
Global website in Magento
In Magento store configuration, a global website refers to the top-level structure that represents an overarching entity within the system. It is the highest level of organization in Magento’s multi-store setup, allowing merchants to manage multiple websites from a single Magento installation.
When configuring a global website in Magento, you define the primary settings and configurations that apply to all the websites within the Magento installation. These settings include the default language, default currency, default customer group, and other global preferences.
By utilizing global website configuration, merchants can efficiently manage multiple websites, each with its own unique domain, design, product catalog, and customer base, all within a single Magento instance. This capability is especially beneficial for businesses operating in different countries or targeting distinct market segments.
Some key aspects of global website configuration in Magento include:
- Store Views: Within a global website, you can create multiple store views. Store views represent the different language or regional variations of a website. For example, if you have an international presence, you can create store views for different countries or regions, each with its own language, currency, and content.
- Catalog Management: Global website configuration allows you to control the product catalog for each website. You can assign specific products to different websites or store views, set different pricing and inventory levels, and manage localized content and attributes.
- Customer Segmentation: Magento enables you to define customer groups and segment your audience based on different criteria. With global website configuration, you can set default customer groups for each website, enabling personalized experiences and targeted promotions.
- Localization: Global website configuration also encompasses localization settings, such as date and time formats, language translations, and regional tax rules. This allows you to adapt your store to the preferences and regulations of different countries or regions.
By leveraging global website configuration in Magento, merchants gain centralized control and flexibility in managing multiple websites, while still maintaining distinct branding, localization, and customer experiences for each site.
Website View in magento 2
In Magento 2, a website view refers to a specific instance or representation of a website within a Magento installation. It is a subcomponent of a website and represents a specific language, region, or customization of the website.
Here are the key aspects of website views in Magento 2:
- Language and Localization: Website views allow you to cater to different languages and regions by providing localized content, translations, and regional settings. Each website view can have its own language, currency, and other locale-specific configurations.
- Design and Theme: With website views, you can customize the design and theme of your website for different target audiences. This includes variations in layout, colors, fonts, and other visual elements. You can assign different themes to different website views, allowing you to create unique experiences for each.
- Content Management: Website views enable you to manage content specific to a particular language or region. You can create and display localized content, such as banners, promotional messages, and product descriptions, tailored to the target audience of each website view.
- Catalog and Product Configuration: Website views allow you to manage the catalog and product configuration specific to each view. This includes assigning products to specific website views, setting different pricing and inventory levels, and customizing product attributes based on the target audience.
- Customer Experience: Each website view can provide a personalized customer experience. This includes displaying localized content, presenting relevant products, and adjusting the pricing and currency based on the selected view. Customers can switch between different website views to access the content and products that are most relevant to them.
Website views in Magento 2 provide the flexibility to create customized and localized experiences for different target audiences, while still maintaining a unified backend administration. This feature is particularly useful for businesses operating in multiple countries or regions, as it allows them to cater to diverse customer preferences, languages, and cultures effectively.
Store view
In Magento 2, a store view is a component of the store configuration that represents a specific instance of a website view. It is a subcomponent of a website and allows you to present your store in different languages or with different designs to cater to diverse customer preferences.
Here are the key aspects of store views in Magento 2 store configuration:
- Multilingual Support: Store views enable you to provide localized versions of your store in different languages. You can create multiple store views, each representing a specific language, and configure translations, labels, and content for each store view. Customers can select their preferred language and view the store in their chosen language.
- Design Customization: Store views allow you to customize the design and theme of your store for different purposes or target audiences. You can assign different themes to each store view, customize layouts, colors, fonts, and other visual elements to create unique experiences for different store views.
- Catalog Management: Store views enable you to manage your product catalog for each view. You can assign products to specific store views, set different pricing, inventory levels, and product attributes based on the target audience of each store view. This allows you to present different products or pricing for different languages or regions.
- URL Structure: Store views can have their own URL structure, allowing you to have language-specific or region-specific URLs for better SEO and user experience. For example, you can have www.example.com/en for the English store view and www.example.com/de for the German store view.
Configuration scope
The Store View chooser in the upper-left corner of many configuration pages filters the view of the page for a specific scope, and sets the value of some entities that are used by Commerce. It lists each level in the hierarchy by name, and is used to change the scope to another level. Any settings that represent the current scope are grayed out, so only those that represent the current scope setting are available. The scope is initially set to Default Config. For Admin users with restricted access, the list of available store views includes only those to which the user has permission to access.


Use system value
The Use System Value checkbox to the right of many configuration settings is used to either apply or override the default field value within the current configuration scope. The default field value cannot be changed when the checkbox is selected. To change the value, clear the checkbox and enter the new value. You are prompted to confirm whenever you change the system value.
The checkbox label changes according to the current scope, and always refers to the parent level that is one step up in the scope hierarchy. Because the parent level is a container for all the items below that level, the scope setting from the parent level is inherited unless it is overridden.
Default value options

Set the scope
Before making a configuration setting that applies only to a specific website, store, or store view, do the following:
On the Admin sidebar, do one of the following:
1)For most configuration settings, go to Stores > Settings > Configuration.
2)For design-related settings, go to Content > Design > Configuration. Then in the grid, choose the applicable store view.
Navigate to the configuration setting to be changed and do the following:
1)In the upper-left corner, set Store View to the specific view where the configuration applies. When prompted to confirm scope switching, click OK. A checkbox appears after each field, and additional fields might become available.
Clear the Use system value checkbox after any field that you want to edit. Then, update the value for the view.
3)On the Admin sidebar, do one of the following:

Scope quick reference




Set up multiple websites, stores, and store views in the Admin
This task requires you to create a root category (and additional categories if desired) for each store. The tasks discussed in this topic provide one way to set up multiple stores. For additional information, see the following resources in the Magento User Guide:
- Categories
- Adding Websites
- Store URLs
- Content
Step 1: Create root categories
Creating a root category is optional, but we show how to do it in this tutorial in the event you want each website to have a unique root category. You can create additional categories if you choose.
To create a root category:
- Log in to the Admin as a user authorized to create categories.
- Click Catalog > Categories.
- Click Add Root Category.
- In the Category Name field, enter a unique name to identify this category.
- Make sure Enable Category is set to Yes.
The following figure shows an example.

6)Click Save.
7)Repeat these tasks as many times as necessary to create root categories for your stores.
Step 2: Create websites
To create a website:
- Log in to the Admin as a user authorized to create websites, stores, and store views.
- Click Stores > Settings > All Stores.
- On the Stores page, click Create Website.
Name—Enter a name to identify the website.
Code—Enter a unique code; for example, if you have a French store, you can enter french
Sort Order—Enter an optional numerical sort order.
The following figure shows an example.

Step 3: Create stores
To create a store:
- In the Admin panel, click Stores > Settings > All Stores.
- On the Stores page, click Create Store.
- Web Site—Click the name of the website with which to associate this store.
- Name—Enter a name to identify the store.
- Code—Enter a unique code to identify the store.
- Root Category—Click the name of the root category for this store.
The following figure shows an example.

5)Click Save Store.
6)Repeat these tasks as many times as necessary to create your stores.
Step 4: Create store views
To create a store view:
- In the Admin panel, click Stores > Settings > All Stores.
- On the Stores page, click Create Store View.
- Store—Click the name of the store with which to associate this store view.
- Name—Enter a name to identify this store view.
- Code—Enter a unique name to identify this store view.
- Status—Select Enabled.
The following figure shows an example.

5)Click Save Store View.
6)Repeat these tasks as many times as necessary to create your store views.
Step 5: Change the website base URL
To change the website base URL:
- In the Admin panel, click Stores > Settings > Configuration > General > Web.
- From the Store View list at the top of the page, click the name of one of your websites as the following figure shows.

3)In the right pane, expand Base URLs.
4)In the Base URLs section, clear Use system value.
5)Enter the http://french.magento.mg URL in the Base URL and Base Link URL fields.
6)Repeat the previous step in the Base URLs (Secure) section.
7)Click Save Config.
8)Repeat these tasks for other websites.
Step 6: Add the store code to the base URL
Magento gives you the option to add the store code to the site base URL, which simplifies the process of setting up multiple stores. Using this option, you do not have to create directories on the Magento file system to store index.php and .htaccess.
This prevents index.php and .htaccess from getting out of sync with the Magento codebase in future upgrades.
To add the store code to the base URL:
- In the Admin panel, click Stores > Settings > Configuration > General > Web.
- From the Store View list at the top of the page, click Default Config as the following figure shows.

- In the right pane, expand Url Options.
- Clear the Use system value checkbox next to Add Store Code to Urls.
- From the Add Store Code to Urls list, click Yes.

- Click Save Config.
- If prompted, flush the Magento cache. (System > Cache Management).
Step 7: Change the default store view base URL
You must perform this step last because you will lose access to the Admin; your access returns after you set up virtual hosts as discussed in the web-server-specific topics.
To change the default store view base URL:
- In the Admin panel, click Stores > Settings > Configuration > General > Web.
- From the Store View list at the top of the page, click Default Config.

- In the right pane, expand Base URLs.
- In the Base URLs section, clear Use system value.
- Enter the http://magento.mg URL in the Base URL and Base Link URL fields.
- Repeat the previous step in the Base URLs (Secure) section.
- Click Save Config.
Conclusion
In conclusion, store configuration in Magento 2 is a crucial aspect of managing an online store. It allows merchants to customize various settings and options to meet their specific business needs. By accessing the backend configuration settings, administrators can control the overall functionality, appearance, and behavior of their Magento store.
- The store configuration in Magento 2 offers a wide range of options, including general settings, website setup, store views, currency and language settings, tax configuration, shipping and payment methods, customer-related settings, and much more. These settings enable merchants to create a personalized and optimized shopping experience for their customers.
- One of the key advantages of Magento 2’s store configuration is its flexibility and scalability. With the ability to set up multiple websites, store views, and store scopes, merchants can cater to different regions, languages, and target audiences. This flexibility allows businesses to expand internationally or serve niche markets effectively.
- Overall, store configuration in Magento 2 plays a pivotal role in managing and optimizing an online store. By leveraging the comprehensive settings and customization options available, merchants can create a tailored shopping experience, streamline operations, and ultimately drive customer satisfaction and business growth.