You are currently viewing How To Set Up Salesforce For B2B Commerce On Lightning Experience

How To Set Up Salesforce For B2B Commerce On Lightning Experience

Sharing is caring!

The pandemic has left a dramatic impact on businesses all over the globe. More and more businesses are rethinking their priorities for online commerce and digital enablement. As a result, these organizations have adopted new channels at a faster rate than the usual pace. 

In today’s business environment, various companies who were traditionally using face-to-face sales channels have now realigned their sales strategies for using commerce platforms. Salesforce’s B2B Commerce platform helps the companies to overcome many challenges with solutions and functionalities based more on configurations and less code. 

In this post, we will provide insights on how to set up Salesforce for B2B Commerce on the Lightning Experience platform. First, let us find out what B2B Commerce is. 

What Is B2B Commerce?

When people think of eCommerce, they often think of the ease of online shopping in their daily lives. But there’s another world of eCommerce with its own unique relationships and buying capabilities: business-to-business (B2B) commerce.

Businesses in the B2B market are turning to B2B Commerce, an eCommerce platform specifically designed for businesses making purchases online. It enables companies to create exceptional eCommerce storefronts and experiences for their business customers.

How To Set Up Salesforce For B2B Commerce On Lightning Experience?

1. Sign up for a Developer Edition

Follow this link:

2. Enable Experience Cloud

    a) From setup a Digital Experiences, enable Experience Cloud and create a domain.

b) Choose, allow using standard external profiles for self-registration, user creation, and login, as shown in the below figure.

3. Enable Commerce Features

Enable Commerce to provide important features for your stores, including objects and workspaces. 

  •  From Setup, in the Quick Find box, enter Commerce. Select Commerce, and then select Settings.
  •  Click the toggle so that it shows Enable Commerce, as shown in the below figure. 
  •  Click save.

4. Enable Order Preferences

  • From Setup, reach Order Settings and choose Enable Enhanced Ecommerce Orders. Choose the other 2 options as shown in the below figure.

  • Click Save. 

Note: After you enable this option, you can’t disable it

5. Enable & Activate CMS

  •  Edit System Administrator profile and choose Salesforce CMS at Custom App Settings section, as shown in the below figure. 

  • Go to Tab Setting Section and make the following tabs as Default On for these 4 CMS items:

  • CMS Home
  • CMS Channels
  • CMS Experiences
  • CMS Workspaces
  • Make the following tabs to Default On too.

  • Commerce Setup
  • Buyer Group Price Books 
  • Buyer Groups
  • Catalogs
  • Categories
  • Entitlement Policies 
  • Guest Buyer Profile
  • Price Adjustment Schedules
  • Pricing Workspace
  • Product Workspace
  • Store Price Books
  • Stores
  • Order Summaries
  • Verify CMS

From App Launcher open Salesforce CMS App and verify tabs.

6. Configure Sharing Settings

Sharing settings, make Default Internal Access and Default External Access to be Public Read Only for

  • Catalog
  • Electronic Media Group
  • Order Delivery Method

7. Update Page Layouts

  •  Product Page Layout

  • Product SKU field to be added in layout
  • Categories and Commerce Entitlement Policies to be added in related list
  • Order Summary Page Layout

Keep only Start Reorder action at Salesforce Mobile and Lightning Experience Actions section, as shown in the below figure and remove others.

  • Order Delivery Group Summary Page Layout

Add Product Name as a column in Order Product Summaries Related List, as shown in the below figure. 

  • Account Page Layout

  • Add Community Members and Contact Point, and Address as Related List
  • Enable as Buyer actions to be added in Salesforce Mobile and Lightning Experience Actions, as shown in the below figure. 

8. App Builder Settings – Account Record Page

Choose any Account record and edit Page, drag Buyer Account component to the page layout, as shown in the below figure.

9. Permission Sets for Buyers, Buyer Managers, and Account Switchers

a) Buyer Permission Set

  • Create permission set name as Commerce User and assign Customer Community Plus license, as shown in the below figure. 

  • Assign Read access to following objects:
    • Accounts
    • Buyer Accounts
    • Catalogs
    • Categories
    • Electronic Media Groups
    • Locations
    • Order Delivery Methods
    • Order Summaries
    • Price Books
    • Products
    • Product Category Products
    • Stores
    • Store Catalogs

Here is an example:

  • Assign Full CRUD access to following objects:
    • Carts
    • Contact Point Addresses
    • Orders
    • Wish Lists

  • For Contact Point Address object, assign Read permission to all fields.

  • Assign System Permissions
    • Commerce User
    • Run Flows

b) Buyer Manager Permission Set

  • Clone Buyer permission set and name it as Buyer Manager
  • From System Permissions, choose B2B Commerce Super User
  • From App Permissions, choose Delegated External User Administrator

b) Account Switcher Permission Set

  • Create a new permission set named Account Switcher and assign Customer Community Plus license
  • In the System Permission section, choose Account Switcher User

10. Install Commerce Reports

    Install commerce reports to track Commerce orders. 

  1. Set the field-level security for Orders, Sales Store. 

a. From the Object Manager, enter Order in the Quick Find Box. 

b. Select Order > Fields & Relationships > Sales Store. 

c. Click Set Field-Level Security. 

d. Make sure that Visible is selected for Commerce Business User and System Administrator.

11. Finalization of Commerce Setup

Quick links in the Commerce app direct merchandisers and commerce admins to pages where they can create a store, install reports, manage data, and enhance products. They can use the navigation menu to move between stores, products, price books, entitlements, buyer groups, and more. To optimize the app for your commerce admins and merchandisers, you can add objects and tabs. 

  • Commerce Setup from App Launcher and verify this: 

  • Install 3 out-of-box reports clicking on Commerce Setup which are as follows: 
    • Average Order Value
    • Orders By Date
    • Total Orders

The Storefront will look like the below figure and all the snaps are my own:

Here is the data model on B2B: 

Let’s get started

1. Create Product, Price Book and Price Book Entries

  1. Create a new Product as follows and mark Product as Active.

b) Create Price Book called Webstore and add products into it.

2. Load Content into CMS

a) Go to Salesforce CMS App and Create CMS Workspace naming Elearning Workspace and follow the next steps as default.

In the language tab, select English and make that default. Final Review Screen is as follows:

b) Add Content in the Elearning Workspace. Upload from your desktop, save draft and publish it.

c) Map Product and Content

From Commerce App -> Product Workspace -> Choose a Product -> Product Detail Page -> Click on Media Tab (as shown below ) 

d) Create a few more products either manually or through a data loader, associate them with price books and assign media content. Here is an example:

3. Create a Store

From Commerce App -> Create a Store -> Choose B2B Commerce Template and click on Get Started 

Name it as CommerceV3

It will take a few moments to create and finally, we will land on the Store Home Page

4. Let’s map Community and CMS Channel

a) Click on Experience Builder

Go to Security & Privacy

  • Make Security Level to Relax CSP, as shown in the below figure. 
  • Add a trusted site if anything is needed.

b) Assign Permission Set

Go to Administration -> Members -> Assign permissions according to your choice.

d) Assign CommerceV3 Store as Channel. Follow following steps:

  • Switch to Salesforce CMS and click on CMS Home
  • Open the workspace which you created earlier.
  • Click on the Channels button, as shown in the below figure.     
  • Add a Channel

5. Create Catalog and Categories

a) From Commerce App -> Catalogs

b) Create a new Catalog named Learning

c) Create a Category named Grade-Level

6. Add Products to Categories

a) From Commerce App -> Product Workspace -> Product Detail -> Categories -> Assign

b) Similarly, add the rest of Products to respective Categories. It will look like this:

7.   Configure Account, Contacts and Buyer Groups

a) Create a new Account naming Test B2B and Enable it as Buyer, as shown in the below figure. 

Find the following details on Account Detail Page:

b) Create a Contact under Test B2B Account, let’s say Peter Parker and provide your email address.

c) Few more things to do on Contact are as follows:

  • Edit contact page layout and add enable customer user action and log in to experience as user, as shown in the below figure.

  • From Peter Parker Contact record, click on Enable Customer User to create a user.
  • During user creation choose Customer Community Plus as license

d) Create a Buyer Group from Commerce App, and name it ‘B2B Buyer Group’.

e) From Buyer Group Related List, assign Account as Buyer Group Member

8. Associate Catalog, Buyer Group and Price Book with Store

a) From Commerce App -> Stores -> CommerceV3

b) Assign Catalog i.e. Learning with this Store

c) Assign Buyer Group i.e. ‘B2B Buyer Group’ with this store

d) Assign Price Book i.e. Webstore with this store after assigning green checkmark as shown in the below figure.

9. Define Commerce Entitlement Policies

 a) Create entitlement policy from Commerce App naming Learning Policy LWT as shown in the below figure.

Note : Be sure to choose View Products and View prices in catalog

b) Assign products and buyer groups to this entitlement policy from the related list.

10. Build Search Index

a) From Store -> Go to Search

b) Add Filters if you have picklist values in Product.

c) From Search Index Summary -> click on Rebuild Index, as shown in the below figure. 

Note: If you add products, categories, price be sure to Rebuild Index to reflect them on Storefront.

11. Customizing Experience Builder Components

     a) Customizing Product Detail Page

        Open Builder, select Product Detail Page and drag    

        Product Detail Card on the layout and add desired  

        fields, as shown in the below figure. 

  1. Configure Checkout Flow

  • Choose checkout page -> select the Checkout Flow component -> Edit Flow in flow Builder, as shown in the below figure. 

  • Choose Checkout Flow Template and Save as “CommerceV3” and from advanced -> Change How to run flow to “System Context with Sharing – Enforces Record-level Access”, as shown in the below figure. 

12. Register Reference Implementation Classes

     a) Take following 4 classes from github

  • B2BDeliverySample.apxc
  • B2BCheckInventorySample.apxc
  • B2BTaxSample.apxc
  • B2BPricingSample.apxc

b) Add Remote Site Settings for:

c) Register classes:

  • API version will be 52.0 (check the version from your org)
  • Replace the code as follows taking help from this documentation
  • Run the code at Developer Console in Execute Anonymous mode

apexClassname  registeredProviderType  registeredDevName 
B2BPricingSample Price COMPUTE_PRICE
B2BCheckInventorySample    Inventory CHECK_INVENTORY
B2BDeliverySample Shipment COMPUTE_SHIPPING

d) Map Store Integration Services

 From Commerce App -> Store -> Administration Tile

 Link all of classes as Registered External Services.

Section Mapping
Shipping Calculation COMPUTE_SHIPPING
Tax Calculation COMPUTE_TAXES

After registering it will look like this:

13.  Activate Store

Finally, from Commerce App -> Store -> Administration Tile -> Store activation, as shown in the below figure.

We are done on setting up with all configurations. Now Goto Peter Parker Contact Record and Log into Experience builder and Test it.


Due to the pandemic and in the existing business environment, the traditional companies using face-to-face sales channels have now realigned their sales strategies for using commerce platforms.  Salesforce’s B2B  Commerce platform helps companies to overcome many hurdles with solutions and offer functionalities with configurations and less code. Companies are turning to B2B Commerce, an eCommerce platform designed for businesses making purchases online to deliver outstanding eCommerce storefronts and experiences for their business customers..

Cloud Analogy’s professional Salesforce Admin & Developer Support Services can help you save money on technology by providing proven administrative and customisation services for Salesforce technology. Get in touch now! 


Ajay Dubedi

CEO | Founder
Ajay Dubedi, the founder and CEO of Cloud Analogy, is a prominent Salesforce Sales, Service, and Marketing cloud Consultant with a rich expertise in handling challenging business models. Ajay has assisted and implemented solutions in industries comprising Banking, Health Care, Networking, Education, Telecommunication and Manufacturing. Ajay is globally acclaimed for his extensive experience in APEX Programming, VisualForce pages, Triggers, Workflows, Page Layouts, Roles, Profiles, Reports & Dashboards.

Hire the best Salesforce Implementation Partner. Choose Cloud Analogy, the world's most preferred Salesforce Implementation Company that provides custom CRM Implementation services.

Leave a Reply

× How can I help you?