Magento 2 Creating new Websites / Stores / Store Views

You can add the following lines to the file etc/config.php and then run

bin/magento app:config:import

The below code will add a new Website, Store, and Store View to Magento database.

 'scopes' => [
        'websites' => [
            'example' => [
                'website_id' => '2',
                'code' => 'example',
                'name' => 'Example Name',
                'sort_order' => '0',
                'default_group_id' => '2',
                'is_default' => '0',
            ],
        ],
        'groups' => [
            2 => [
                'group_id' => '2',
                'website_id' => '2',
                'name' => 'EXAMPLE_store',
                'root_category_id' => '2',
                'default_store_id' => '2',
                'code' => 'example_store',
            ],
        ],
        'stores' => [
            'psuk_default' => [
                'store_id' => '2',
                'code' => 'example_default',
                'website_id' => '2',
                'group_id' => '2',
                'name' => 'EXAMPLE_default',
                'sort_order' => '0',
                'is_active' => '1',
            ],
        ],
    ],

 

Gareth
Buy Me A Coffee
back arrowBack to Index