How do you work in a single sandbox with multiple users while maintaining separate storefront sites as a business manager?

In most of the cases in SFCC, it is not recommended to work on a single sandbox by multiple developers, as the recommended way is to work with one developer in a single sandbox. Still, there is a way to use it in one sandbox with multiple developers, whereas each developer has their own site that can show changes using their respective custom cartridge.

The approach is similar to a production instance, where one brand shares the same production instance for a separate site for each region or country.

Here are the steps that should be followed to complete the setup

Get Backup from an Existing Sandbox (optional)

Follow the below path in Business Manager to get a backup (import sandbox data).

  • Administrative -> Site Development -> Site Import & Export
  • Go to the Data Units to Export section and select the sites and other required fields that you want to take as a backup, give them an archive name, and then click on Export.
  • Then you’ll get it under Status, as it is running a job with a start time and Status, and you can check to see if it is completed.
  • Then scroll up and go to the Upload archive section, click on the newly created zip file link, and click on it to download it to your local system.

Login to a different sandbox (Restore the backup data to the new sandbox)

  • Unzip your downloaded backup zip file first, and then edit the relevant fields within the file
  • The folder name, site ID name, and title name are within the site XML file, and all the folder names with old names have a new site name.
  • After changing all the names again, zip the parent folder and follow the same path to import the file into the new sandbox you want to use.

Follow the below path in Business Manager to import sandbox data

  • Administrative -> Site Development -> Site Import & Export
  • Go to upload archive and select local, then click on choose file to choose a zip file, and then click on import. After the upload is complete, select the same uploaded file, and then click on the import option below.
  • It will run a job with the status running or completed, and after completion, you can see the changes inside the new sandbox.
  • After that, you’ll see your site imported successfully inside the new sandbox, and now you can select it to see its storefront.

Points to notice while doing this task

  • To login inside the sandbox, use the credentials that are provided by your organisation, which are already configured with authentication and an account centre, or you can log in using other credentials if required.
  • If you are creating new custom code in your existing workspace, then you need to run these commands to set up a new custom layer over a base layer.
mkdir app_custom_sitename
cd app_custom_sitename
npm install –g sgmf-scripts
sgmf-scripts --createCartridge app_custom_sitename
  • You have the option of running all three of these commands.
npm run compile:scss
npm run compile:js
npm run compile:fonts
  • Change the dw.json file, which is available inside the SFRA code base, and change the hostname to the newly respective sandbox URL and the code version.
// dw.json file 

{
"hostname": "new-sandbox-url",
"username": "username@cloudodyssey.co",
"password": "pass",
"code-version": "current-code-version"
}
  • After creating a new custom layer in your workspace, go to the cartridge path inside site development and change the cartridge path to first your custom layer cartridge base layer cartridge, and then click on Apply. Then, use prophet debugger to push all the cartridges to the sandbox, and select “Leave all code” when you get the pop-up while uploading the code into the sandbox.

And then, select your own site and make changes to see it in the storefront.

Find out more about Salesforce Commerce Cloud

How to Calculate Sales Tax In Salesforce Commerce Cloud

How to Connect Slack Workspace to Salesforce Commerce Cloud Business Manager

How to collect payments from Salesforce Commerce Cloud Storefront without writing code