>Step-by-step guide to set up Magento 2 Multiple Store Views

Step-by-step guide to set up Magento 2 Multiple Store Views

In the previous blog, we have discussed the differences between multi websites and multi-store views as well as the benefits and convenience of multiple store views. As you know, creating multiple store views in Magento 2 is never ever easy, it will make administrators get some confuses. So in this blog, we will help you to solve out your problem.

Things to bear in mind before start:

  • If you want to create a new website, you should follow every step below
  • However, if new stores share the same catalog and products with your default store, you can skip several initial steps and move toward to STEP 3

Now let’s start!

Step 1: Create root categories

    • Log in to the Magento Admin as a user authorized to create categories.
    • Click Products > 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.
    • Click Save.

Add root category

Step 2: Create websites

    • 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 (note: the code must be unique string without space and keep this code for later use).
    • Sort Order: Enter a number to set short order showing in the store lists.
    • Click Save Web Site.

Step 3: Create stores

    • 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.
    • Click Save Store.

Step 4: Create store views

    • 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.
    • Click Save Store View.

Step 5: Set up the URL of the store

    • In the Admin panel, click Stores > Settings > Configuration > General.
    • From the Store View list at the top of the page, select a website.
    • Select Web option, and click to expand the Base URLs and Base URLs (Secure) sections
    • In the Base URLs section, fill in your store’s URL with one of the following methods:
    • To use your main store URL, you select the Use Default check box.
    • To specify a store URL other than your main, locate the Base URL field, type your store URL, and include the “/” at the end of the URL.
    • Then you repeat in the Base URLs (Secure) section.
    • Finally, you click Save Config.

Step 6: Add the store code to the base URL

Adding the store code to the site’s base URL helps you simplify the process of setting up multiple stores by not creating directories on the Magento file system to store index.php and .htaccess. It also helps you prevent index.php and .htaccess from getting out of sync with the Magento codebase in future upgrades.

Following are the examples of URL with and without store codes in Base URL:

With store code: http://www.yourdomain.com/magento/[store-code]/index.php/url-identifier

Without store code: http://www.yourdomain.com/magento/index.php/url-identifier

    • Go to Stores > Settings > Configuration. Under General section, click Web.
    • From the Store View list at the top of the page, select Default Config.
    • Expand URL Options section.
    • Uncheck the Use system value box, then set this to Yes.
    • Click Save Config.

It’s done! You have successfully set up multiple websites and stores in Magento 2. Here’s the result:

Now your customers can choose which store view is suitable and convenient for them instead of only the default store view.

Besides, if you have multiple store views, the Magento 2 extensions below may be helpful for you. Here’s the list of these extensions:

Wrapping it up

In conclusion, we can say that Magento 2 multi-store views are very useful and efficient for any business, offering many advantages. However, setting up multi-store views is quite complicated because there are many steps. Here’s a long tutorial, but hope that it’s useful and easy for you to understand. Read now and learn how to work with Magento multi-store views.