4/4/2019 - #development #ecommerce #magento
by: Emilie Wittmann

One of the many advantages of Magento is the native management of the multisite. It is easy to create many websites in the same instance of Magento and imagine an infinite number of different cases.

For example, you may need a new store on Magento to be able to run a new physical warehouse with different products and stocks. Several storeviews allow you to make multilingual or multi-currency sites. You can also have different product catalogues and associate them with the stores.  




The Entities:

  • Global: represents the complete instance of Magento
  • A Website: a website can have its own customers and orders, as well as different prices per product. There may also be specific payments or delivery methods that are different from other websites.
  • A Store: a website can have several stores with different menus and a different look. Also, Stores can have different URLs. Finally, they may also have a different category.
  • A Store View: this entity is usually used to configure the different languages and currencies

multiwebsite in Magento

Few examples

It is possible to imagine different scenarios and meet different needs. These are some examples of different uses of multisite on sites developed on Magento 1 or 2.

  • Banana Moon es an online website selling swimwear using Magento. The multi-site mode is used on this site to manage several physical repositories. He can manage the different depots in Europe but also in the United States thanks to the different websites. It can manage a different catalogue and a different list of customers. Each website also has several storeviews to be able to offer several languages to customers.

  • Gallaud Joaillier  is an online shop for personalized jewellery inspired by horseback riding. There are also several websites. One website allows you to manage a catalogue in Swiss francs and the other one manages the catalogue in Euros. Each of the websites is also composed of several storeviews to be able to offer an English and French translation.

  • The Online Store Cache-coeur lingerie is a good example of multisite Store. Specialized in the online sale of maternity underwear and nursing pads, it offers several websites with different themes and urls: www.curvematernity.com et www.cachecoeurlingerie.com. This configuration allows you to have a different catalogue but also a different customer and order book.

  • Blackbird Store. Our own online shop for Magento Extensions is also composed of several websites. We can thus highlight one of our Advanced Content Manager extensions with a specific url: www.advancedcontentmanager.com. The other extensions are sold on our store: store.bird.eu. For each website we use different store views to offer the site in English and French versions. An additional website is also in place to offer a catalogue in US Dollars.

Case study on Magento 2: the creation of different websites and storeviews  

In the back office, go to Stores>Settings>All Stores section.

backoffice Magento - menu

Exemple de config B2B / B2C

Specific configurations

Configure a different theme and url for each website

config template

Configure a different language and currency by Store View

currencies setup


Basic apache routing:


<VirtualHost *:80> ServerName bird.local.com ServerAlias b2b.bird.local.com <Directory /home/web/bird/htdocs/pub> Options FollowSymLinks Multiviews Indexes AllowOverride All Require all granted </Directory> SetEnvIf Host .*b2b.* MAGE_RUN_CODE=b2b_en SetEnvIf Host .*b2b.* MAGE_RUN_TYPE=store </VirtualHost>

More complex routing with language choice

Configuration of the store according to request_uri in the pub/index.php file:

if( strpos($_SERVER['REQUEST_URI'], "b2b.") !== false ){
$store = 'b2b';
$store = 'b2c';
if( strpos($_SERVER['REQUEST_URI'], "/fr/") !== false ){
$lang = 'en';
$lang = 'fr';
} $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = $store.’_’.$lang;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store'; $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

Magento configuration for Store:
same base_url per store
specific configuration for base_link_url

To go further: Change of Store according to geoip or cookies

Changing websites according to cookies in a transparent way for the customer on the same and unique domain.

if ( !empty($_COOKIE[‘b2b’]) && _COOKIE[‘b2b’] === ‘true’ ) {
$store = 'b2b';
} else {
$store = 'b2c';
} $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = $store;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store'; $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

Change storeview according to the geographical location of the customer to display the correct default language.

$record = geoip_record_by_name( $_SERVER['REMOTE_ADDR']); if( strpos($_SERVER['REQUEST_URI'], "/b2b/") !== false ){
$store = 'b2b';
$store = 'b2c';
} if($record->country_name === ‘FR’){
$lang = ‘fr’;
$lang = ‘en’;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = $store.’_’.$lang;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store'; $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

Write your comment

for take-off?

Blackbird is a web agency specialized in the development of eCommerce websites. We are Magento Experts and we offer our services and advice for e-marketing, strategy, branding, deployment and methodology.

+339 50 66 21 38

Legal terms
Agency 30, Avenue du Rhin
67100 Strasbourg