- A Salesforce org where you want to create stores and that serves as a Dev Hub for creating scratch orgs.
- Enable Dev Hub on the org:
- Navigate to Setup by clicking the gear icon located in upper right corner.
- Enter
Dev Hub
in the Quick Find box and select Dev Hub. - Click Enable Dev Hub so it says
Enabled
.
-
Install Salesforce CLI. You can install the CLI with either npm or with a downloadable installer for your specific operating system. See Salesforce CLI Setup Guide for more information.
npm install @salesforce/[email protected] --global
Latest stable version of the SF cli which supports a few newer plugin funtionalities.
-
Install the Commerce plugins.
sf plugins:install @salesforce/commerce
-
Verify that you installed Salesforce CLI correctly and see what version was installed.
sf -v # sample output @salesforce/cli/2.43.7 darwin-arm64 node-v20.13.1
-
Verify that you successfully installed the required plugins and see what versions were installed.
sf plugins # sample output @salesforce/commerce 242.0.26
-
Authorize your org for use with Salesforce CLI.
sf org login web -r <<INSTANCE_URL>> -a <<ORG_ALIAS>> #####example##### # sf org login web -r https://login.test1.pc-rnd.salesforce.com -a mydevhub ###### If you created your own connected app ###### # sf org login web -r <<INSTANCE_URL>> -i <<CONSUMER_KEY/CLIENT_ID>> -a <<ORG_ALIAS>> # sf org login webn -r https://login.test1.pc-rnd.salesforce.com -i XXXXX -a mydevhub
-
Create a scratch org.
Note: By default, new scratch orgs contain 1 administrator user with no password. To generate a password, see Generate or Change a Password for a Scratch Org User.
sf commerce:scratchorg:create -u <<ORG_USERNAME>> -a <<ORG_ALIAS>> -v <<DEVHUB_USERNAME>> -w 15 --json #####example##### # Note: This command creates an Org with both B2B and B2C features. To create an org with just B2B or B2C features pass the type (-t) argument # sf commerce:scratchorg:create -u [email protected] -a demo_org_1 -v [email protected] -w 15 --json
-
Create a B2B Aura store.
sf commerce:store:create -t '<<TEMPLATE_NAME>>' -n <<STORE_NAME>> -o b2b -b <<BUYER_USER_EMAIL>> -u <<ORG_USERNAME>> -v <<DEVHUB_USERNAME>> --apiversion=<<API_VERSION>> #####example##### # Note: The template name for Aura store is 'B2B Commerce (Aura)'. To see the available templates run force:community:template:list. # sf commerce:store:create -t 'B2B Commerce (Aura)' -n b2bstore01 -o b2b -b [email protected] -u [email protected] -v [email protected] --apiversion=57.0
-
Create a B2B LWR store.
sf commerce:store:create -n <<STORE_NAME>> -o b2b -b <<BUYER_USER_EMAIL>> -u <<ORG_USERNAME>> -v <<DEVHUB_USERNAME>> --apiversion=<<API_VERSION>> #####example##### # sf commerce:store:create -n b2bstore02 -o b2b -b [email protected] -u [email protected] -v [email protected] --apiversion=57.0
-
Create a B2C LWR store.
sf commerce:store:create -n <<STORE_NAME>> -o b2c -b <<BUYER_USER_EMAIL>> -u <<ORG_USERNAME>> -v <<DEVHUB_USERNAME>> --apiversion=<<API_VERSION>> #####example##### # sf commerce:store:create -n b2cstore01 -o b2c -b [email protected] -u [email protected] -v [email protected] --apiversion=57.0
-
To see all the orgs that you previously authorized, run
sf org list -all
. -
To see all the available templates run
sf community list template -o <<ORG_USERNAME>>
-
If the org session times out, then logout and log back in again.
sf org logout -o <<ORG_USERNAME>> sf org login web -r <<INSTANCE_URL>> -a <<ORG_ALIAS>>
-
To see the information of an org, run
sf org display -o "<<ORG_USERNAME>>"
. -
For more commands, see the Salesforce CLI Command Reference.