Skip to main content
Blog General

How To Setup Multiple Stores In Magento2?

Pooja Sekar
August 23, 2017 |

First Impressions Matter! Make your online store alluring and likable from the first sight with our Magento Design Services.

Many eCommerce stores begin as a single store selling particular products or services. Over a period of time, when the business expands, they may have more than one product line. They may also expand to other lucrative geographies.

In such cases, there arises a need for multiple websites for the company. Instead of having multiple websites, vendors can have multiple magento stores with the same/different domains using the multi-store feature of Magento. Magento allows the merchant to create multiple stores and store views. Also take a look at Magento store performance

Below is the global website store methodology as defined in “Learning Magento 2 Administration” by Bret Williams & Cyndi Williams.

Global – Global refers to any configuration or setting that affects the entire Magento installation. Some settings such as security, product SKUs, and logging apply to all stores.

Website – Website is akin to a business entity as many of the settings made at this level pertain to payment gateways, shipping, taxes, and so on.

Store – Store is the level where you assign a particular product catalog. It is at this level that we begin differentiating stores by the products offered.

Store View – Store Views are mostly used to handle different languages on your website. You will typically have one Store View per language.

Magento 2 B2B

STEP 1: To create a new website

Login to Magento Backend

  1. Click Store > Settings > All Stores.
  2. On the Stores page, click Create Website.
    • Name: Enter your website name.
    • Code: Enter a unique code for the website.
    • Sort Order: It is an optional field and is set to maximum value ‘0’ by default.
  3. Then Save Web Site.

STEP 2: To create a new store

  1. Click Store > Settings > All Stores.
  2. On the Stores page, click Create Store.
    1. Choose the Website of your choice.
    2. Name the Store.
    3. Choose the Root Category that needs to be displayed within that store.

      To add a new root category follow the steps below.

      1. Go to Product > Categories.
      2. Click Add Root Category in the left column of the page.
      3. Enter the Category Name, enable the category and Save the changes.
  3. Click Save Store.

STEP 3: To create a new store view

  1. Click Store > Settings > All Stores.
  2. On the Stores page, click Create Store View.
    1. Choose the Store of your choice.
    2. Name the Store View.
    3. Set the status Enabled.
  3. Status is an optional field and is set to maximum value ‘0’ by default.
  4. Click Save Store View.

STEP 4: To check for mode and access permissions

Note: This step is for the beginners in Magento 2. If you have not changed to any mode previously then you are set to be in the default mode. To configure the multi-store view, you have to change to the developer mode by following these steps.

    1. Give permissions to the below directories.

chmod -R a+wX var

chmod -R a+wX app/etc

chmod -R a+wX pub

  1. The command to change the mode is,

bin/magento deploy:mode:set developer

Another way to enable developer mode is,

      1. Goto app/etc/ and open env.php
      2. and change current application mode by MAGE_MODE’ => ‘default’ to MAGE_MODE’ => ‘developer’.

STEP 5: To create a new website

    1. Copy the index.php file and .htaccess file from the Magento root directory to the directory created for the new website within the magento root directory.
    2. Replace the code of index.php into the following code snippet.
      • Before:

      • After:

    1. In the Admin, click Stores > Settings > Configuration > General > Web.
    2. From the Store View listed on the top of the page, choose a website, other than the default website.
    3. In the right panel, expand Base URLs. Unselect Use Default. Consider the following as examples to fill the fields.

Base URL : http://localhost/magento/newstore/

Base Link URL : http://localhost/magento/newstore/

Base URL for Static View Files(default value) : http://localhost/magento/pub/static/

Base URL for User Media Files(default value) :   http://localhost/magento/pub/media/

Fill the same in the fields under Base URLs (Secure) if needed for ‘https’ access.

  1. Click Save Config.
  2. Click Flush Magento Cache under System > Tools > Cache Management for better results.
  3. Now you can view the different stores and the store views in the browser by specifying the corresponding URLs.

To integrate a language pack to differentiate the store views with various languages:

Step 1: Goto Find Partners & Extensions in the Admin Panel.

Step 2: Click Visit Magento Marketplace in the right bottom of the page.

Step 3: Search for the extension you need.

Step 4: Download the extension and unzip and extract the content into the specified magento root directory.

Step 5: Refer the documentation and steps given by the extension team and complete the process.

Example extension : Magenerds – de_de for german language pack.

Refer http://doc.magenerds.com/german-language-pack/ for the above extension integration.

Hope the blog was useful. Let us know your feedback and comments.

Pooja Sekar

Pooja Sekar is a Magento 2 Certified Solution Specialist cum Professional Developer. She works on multiple Magento 2 projects from Commerce to Enterprise cloud, playing various roles from being a developer to managing a project. She takes pride in being a cynophilist and loves to wander around.

More posts by Pooja Sekar