# B2B Commerce LE on Scratch Orgs (Winter '21) for Windows WSL
Now that SF B2B is also offered natively (as opposed to as a managed package), it will be possible to take advantage of scratch orgs for faster development or demo purposes. Here is how.
NOTE: These are instructions for the forked version of the b2b-commerce-for-lightning project, adapted to WSL.
- SFDX installed
- You have a devhub, and it's been authorized in your computer (you can even use a Traihead Org as a devhub!) <-- TIP: the command to authorize an org is
sfdx force:auth:web:login -d
- Your IDE of choice (I use VS Code)
- Clone this repo
- Open a WSL terminal window and change to the "sfdx" folder to where the repo was downloaded
- Run the project conversion script
- List available orgs:
sfdx force:org:list --clean
- Set the default devhub:
sfdx force:config:set defaultdevhubusername=<DEVHUB USERNAME>
# Creating the scratch org:
- Create an empty scratch org with a username of your choice (e.g. firstname.lastname@example.org) :
sfdx force:org:create -f config/project-scratch-def.json email@example.com -s -d 30
- Confirm that the scratchorg created was set as the default org. If it is not, you can set it using
sfdx force:config:set firstname.lastname@example.org(this command is also useful to open a different scratch org if needed)
# Optional: going all the way:
- Push the code changes:
sfdx force:source:push -f. This will deploy the sample integrations (Lightning Flow and classes)
- Create a store/community (e.g. 54chi01):
sfdx force:community:create --name "54chi01" --templatename "B2B Commerce" --urlpathprefix "54chi01" --description "Sample store 54chi01 created with SFDX"
- Deploy the rest of the metadata:
- Open the org:
- Go to the Commerce app, select the store and refresh the Search Index.
- Go to the Contact view, open the generated contact and from the dropdown, select "Login As Customer". You should see a storefront up and ready for you to use.
# Additional useful commands
- To open the default org:
- To delete a scratch org:
sfdx force:org:delete -u <SCRATCH ORG USERNAME>