Rate this post

If you have multiple website and you want test them on your development enviroment. How do you do that?

In case multiple store, magento 2 allow you switch among stores via nav bar on header or footer. But nothing for multiple website.

To do that. You can follow steps:

Step 1: Create a new file index2.php in root folder.

Step 2: Add this code:

Step 3: Change this code with your case

$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = ‘<code>’;

$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = ‘{store|website}’;

  • Example:

You have website with code = website_a

switch among multiple websites in magento 2
switch among multiple websites in magento 2

 

  • Let change code:

$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = ‘website_a’;

$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = ‘website’;

Step 4: Enter your magento site

Your Magento website needs a powerful Magento ERP for stock control.

DON'T MISS THE CHANCE!

magento erp

How to Override a Template File in Magento 2 - Magento 2.3
How to Integrate Zopim in Magento 2 Store? - Magento 2.3