Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Explore D2C Developer Features

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe the Commerce data model.
  • Explain the purpose of Salesforce Commerce integration.
  • Explain how predefined flows manage the shipping, inventory, pricing, and tax integrations

Prerequisites

To gain the most from this module, you should have experience with these.

  • VS Code
  • Command line interface (CLI)
  • Salesforce DX

You should be familiar with these:

  • Lightning Web Components (LWC)

Make a Plan

Wei Leung works as a developer for Ursa Major Solar, a solar equipment manufacturer. She helped implement Salesforce Commerce for Ursa Major Solar. Salesforce Commerce supports both business-to-business (B2B Commerce) and direct-to-consumer (D2C) stores. Wei is ready to customize her company’s Salesforce Commerce stores.

Wei Leung, Ursa Major Solar developer

Salesforce Commerce helps brands like Ursa Major Solar launch stores quickly with guided setup, low-code configuration and branding, simplified data import, and shared workflows across clouds. When you configure a Salesforce Commerce solution, you can rely on the trusted power, security, and scalability of all the standard Salesforce platform technologies.

The Salesforce Commerce platform is open and extensible. Its minimal configuration requirements and declarative programming layer let admins like Maria Jimenez and merchandisers like Taylor Givens (both at Ursa Major Solar) quickly complete setup tasks. With streamlined setup and configuration. Wei can focus on enabling integrations and extending platform capabilities.

Wei and the Ursa Major Solar team completed the basic store setup. Now she’s ready to customize and extend Ursa Major Solar’s Salesforce Commerce stores. As Wei explores how to customize her company’s stores she starts by taking these steps.

Step Task

1

Learn about the D2C Commerce integration architecture.

2

Set up the development environment.

3

Customize the store

4

Understand the shadow DOM.

Review the Data Model

Salesforce Commerce capabilities start with the Commerce data model. The data model is a dynamic network of object relationships that links administrative tasks and customer journeys into industry-standard workflows. The model connects the store objects that work in concert to deliver a complete B2B or D2C store experience and back-office manageability. The model supports standard and customizable business objects for many business relationships and for interoperability with Lightning Web Components (LWC), Salesforce Order Management, and Service Cloud. 

D2C Data Model

Wei knows from the Salesforce B2B2C Commerce Basics Trailhead module that the Salesforce Commerce store template is built on the Commerce data model. When she uses the template to create a B2B or D2C Commerce store, the store’s objects have the same default object relationships as the objects specified in the data model. 

Here’s a summary list of data model objects and their APIs.

Data Model Object Description API Name
Store

A website where buyers and shoppers complete Wholesale and retail transactions.


Includes the fields and properties that define your store. For example, supported currencies, languages, and price books. Many fields are customizable.
Webstore
Catalog A catalog is a collection of the products that you sell, organized into different categories. The Commerce Admin or Merchandiser uses data import to set up the catalog. ProductCatalog
Category

Categories and subcategories organize and group products in your catalog and on your storefront.


The Commerce Admin or Merchandiser uses B2C data import to fill in a default compact layout, which includes name, catalog, category, search order, and so on. Layout is customizable.

ProductCategory
Entitlement Policy Entitlement policies are simple entities that bring together buyer groups and products. Filtered by BuyerGroup membership. Includes CanViewPrice and CanViewProduct fields, which are customizable. CommerceEntitlementPolicy
Product The items and services you sell. The Commerce Admin or Merchandiser uses data import to fill in a default compact layout, which includes a variety of customizable fields (name, family, and so on). Product2
Buyer Account The buyer’s or shopper’s financial information, including credit and order limits, some of which pertain only to B2B. A D2C BuyerAccount is established when a shopper self-registers. BuyerAccount
Buyer Group A group of buyers with the same assigned entitlement policies, price books, and products. Buyer Group name and description are customizable. For D2C stores, one buyer group per store is created by default during D2C data import. BuyerGroup
Buyer Group Member An individual buyer associated with a buyer group. BuyerGroupMember
Price Book A price book contains price definitions for a group of products. Typically added during setup with your store’s data import, but you can add custom fields. Pricebook 
Price Book Entry A product entry (an association between a Pricebook2 and Product2) in a price book. PriceBookEntry

Explore Salesforce Commerce Integration

Wei's first customization is to integrate shipping, taxes, and payment capabilities within her Salesforce Commerce stores. People with specific expertise develop these types of packages. For example, tax attorneys who track global tax laws are involved in creating tax software. Likewise, shipping software providers maintain expertise about shipping carriers. This focused expertise allows Salesforce to focus on ecommerce storefront capability.

Wei is glad to know she doesn’t have to code everything herself. She and her colleagues rely on partners to create applications within the Salesforce integrated data model that includes Order Management, CMS, Sales, and Service. A rich and growing AppExchange includes integration packages from leading, third-party partners.

Salesforce Commerce simplifies package integration for these capabilities.

  • Shipping: Calculates and writes shipping costs per delivery group
  • Taxes: Calculates and adds tax prices for cart items
  • Payment: Uses the Salesforce payment gateway adapter framework to fetch tokens and authorizations, and manage exceptions. For example, fraud and insufficient credit from service providers during checkout via a payments gateway.

Salesforce Order Management handles additional services, including capture and refund.

These integrations provide a consistent, quality customer journey. They’re embedded into the cart and checkout experience, triggered by shopper interactions with the storefront UI.

Understand the Integration Architecture

These integration components are part of an overall architecture that’s initiated by a customer action. The customer could be checking out or adding an item to the cart. After an integration is initiated, here’s how the various components work together to form the integration engine.

A shopper action initiates the predefined flow, after which, the various components work together to form the integration engine.Here’s how the predefined flows that manage the shipping, inventory, pricing, and tax integrations work together in the graphic.


Flow Description

1

Cart and checkout processing

Triggered by shopper action.

  • Entering a delivery address initiates shipping charges and tax calculation.
  • Placing an order triggers payment processing.
  • An integrated Salesforce Order Management component processes refunds, capture, and more.

2

Connect REST API

Executes tasks. Service for these discrete APIs for shipping, tax, and payment integrations execute tasks asynchronously and is distinct from the Salesforce B2B Checkout Subflows (Aura) implementation.

3

Task handler

Is implemented as an MQ handler and invoked by the queue manager when the integration task is picked up for processing. The integration handler is responsible for delegating the task to the integration implementation, which the commerce admin or merchandiser specifies when setting up the store.

4

Handler Factory

Creates an integration handler that maps to the implementation chosen by the commerce admin during store setup.

5

Integration services

Uses the store’s configured named credentials, conveys (as a gateway) requests for third-party tax and shipping calculations. The Core Commerce Services (CSS) Adapter and Service Salesforce Payment Adapter request and receive authorizations, tokens, and exceptions from a third-party service via a Payments Gateway.

6

API responses

Sends successful results and exceptions with UI-facing help messages to the shopper’s browser.

Checkout API Integration

Wei is glad to know that Salesforce Commerce comes with Checkout APIs. This lets her execute calls to native or third-party tax and shipping calculation services, which share API trigger and payment integrations.

The API is triggered when the shopper clicks Checkout or revisits a checkout session from their browser. After the API is triggered, the API is engaged as the shopper selects (or enters) the address, shipping method, and payment method, and places the order.

After the shopper clicks Checkout or returns to checkout, the API is engaged as the shopper selects the address, shipping method, and payment method, and places the order.Here are the APIs.

  • Shipping and Tax Integration: A single API call fetches both shipping and tax costs for cart items.
  • Payments Integration: D2C Commerce, like Lightning B2B, uses the Salesforce Payment Adapter framework to fetch tokens and authorizations from service providers during checkout.

Next Steps

In this unit, you learned that Salesforce Commerce has a predefined set of flows to simplify package integration for these providers. Next, learn how to set up the development environment.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback