Salesforce B2B Commerce handles complex business buying by applying contract terms, account-specific pricing, and role-based access directly within the platform. Buyers see storefronts tailored to their role, region, and agreements, with Business Manager managing what products, prices, and actions are visible.

OCAPI supports real-time validation of pricing, inventory, and checkout rules based on the buyer's account. Large businesses can use this setup to manage multiple sites, custom catalogs, and quote workflows without any manual adjustments.

Salesforce B2B Features

Account-Based Pricing & Contract Negotiation

In runtime, pricing tiers resolve during cart validation by querying Contract Entitlements via OCAPI, which cross-references the buyer’s account ID against pre-negotiated terms. The platform merges Price Book data with real-time inventory checks before rendering. Implementation uses Salesforce CPQ-synced contracts, stored as custom objects, and enforces them through Business Manager workflows.

Multi-Site & Multi-Org Buyer Hierarchy

B2B Commerce resolves buyer hierarchies by evaluating Account Groups and Organization Nodes during session initialization. The storefront fetches entitlements via OCAPI /account/{accountId}/entitlements, filtering catalog visibility and checkout rules. Enterprise deployments map these hierarchies to Sites in Business Manager, isolating inventory and pricing per subsidiary.

Entitlement Logic with OCAPI & Business Manager

Entitlements execute during add-to-cart and checkout flows, invoking OCAPI endpoints like /baskets/{basketId}/entitlements. Rules in Business Manager enforce minimum order quantities or approved SKUs. Developers extend these checks by injecting custom logic into pipelines or hooks before basket calculation.

Real-Time Quote-to-Order Conversion

During checkout, buyers with negotiated contracts can convert quotes into orders via OCAPI /baskets/{basketId}/convert-to-order, which validates pricing against the latest Contract Entitlements. The system enforces approval workflows by checking Custom Object fields before allowing submission.

code
// SFRA middleware for quote validation
code
server.post('ConvertQuoteToOrder', (req, res) => {
code
const basket = req.querystring.basketId;
code
const quoteValid = checkQuoteApproval(basket); // Custom logic
code
if (quoteValid) {
code
ocapi.post(`baskets/${basket}/convert-to-order`).then(order => {
code
res.json(order);
code
});
code
} else {
code
res.setStatusCode(403); // Reject unapproved quotes
code
} });

Explanation:

  • Runtime Role: Blocks checkout until quote is approved
  • Data Model: Ties to Quote__c custom object in Business Manager
  • Optimization: Caches contract terms to reduce OCAPI calls

AI-Powered Search with Einstein

Einstein refines B2B search by weighting results based on buyers’ past orders and contract-entitled SKUs. The platform intercepts search queries via OCAPI /search, injecting einstEinsteinQueryIntent to prioritize relevant items. Custom ranking rules in Business Manager override defaults for specific account groups.

code
// Einstein-enhanced search in SFRA
code
SearchModel.setSortingRule('contractPriority', (products, req) => {
code
const accountId = req.session.raw.accountId;
code
return products.sort((a, b) => {
code
return a.isEntitled(accountId) ? -1 : 1; // Push entitled SKUs first
code
});
code
});

Explanation:

  • Use Case: Technical buyers searching for compatible parts
  • Integration: Leverages OCAPI’s refine_attributes for filters
  • Performance: Pre-fetches entitlements during session initialization

SalesForce B2B Features in Video Workflow

Network-Aware Product Demo Gating

Video delivery on PDPs evaluates navigator.connection.effectiveType to switch between 4G-optimized (480p) and Wi-Fi (1080p) streams. The platform uses CDN edge functions to reroute requests based on real-time network telemetry. Einstein tracks buffering events, adjusting future defaults per buyer.

code
// PDP video loader (SFRA middleware)
code
if (navigator.connection.effectiveType === '4g') {
code
loadVideo('product-demo', { resolution: '480p', cdn: 'akamai-edge' });
code
} else {
code
loadVideo('product-demo', { resolution: '1080p', cdn: 'fastly-premium' });
code
}

Explanation:

  • Optimization: Defers 1080p load until Wi-Fi detection.
  • Use Case: Heavy machinery demo videos.
  • Interaction: PDP → Network CheckCDN SwitchEinstein Log

Role-Based Video Personalization

Procurement managers see ROI-focused explainers, while technicians receive installation guides. The system maps Shopper Roles to Media Sets in Business Manager, rendering variants via {% if role == 'procurement' %} ISML tags. OCAPI /content/assets delivers role-specific JSON manifests.

Einstein Video Engagement Tracking

Scroll-triggered listeners log viewport visibility via IntersectionObserver, sending metrics to Einstein through Web Workers. The data shapes real-time recommendations, such as suggesting complementary SKUs after 80% video completion.

code
// Scroll-triggered tracking (Web Worker)
code
const observer = new IntersectionObserver((entries) => {
code
if (entries[0].isIntersecting) {
code
self.postMessage({ event: 'video_impression', videoId: 'xyz' });
code
}
code
}, { threshold: 0.8 });

Explanation:

  • Optimization: Offloads analytics to background thread
  • Use Case: Post-view quote requests
  • Interaction: PDPIntersectionObserverWeb WorkerEinsteinCPQ

Bandwidth-Aware Adaptive Streaming

For large industrial equipment demos, the platform uses MPEG-DASH manifests adjusted via CDN edge logic. A client-side script tests bandwidth using navigator.connection.downlink, switching between bitrates (e.g., 2Mbps for 4K, 500Kbps for mobile).

code
// Adaptive bitrate switching (PDP)
code
const bandwidth = navigator.connection.downlink;
code
const videoSrc = bandwidth > 5 ? '4k-stream.mpd' : 'hd-stream.mpd';
code
document.querySelector('video').src = videoSrc;

Explanation:

  • Optimization: Reduces buffering for global buyers
  • Use Case: Factory equipment walkthroughs
  • Tracking: Einstein logs bitrate changes for QoS analysis

Interactive Video Hotspots for Product Configurations

Videos embedded in PDPs include clickable hotspots that trigger SKU updates or add-to-cart actions. The platform binds hotspot metadata to Product Sets in Business Manager, rendering them via data-video-sku attributes.

code
<!-- Video hotspot with SKU binding -->
code
<video data-product-id="prod123">
code
<track kind="metadata" src="hotspots.vtt" />
code
</video>
code
<script>
code
document.querySelector('video').addEventListener('click', (e) => {
code
const sku = e.target.getAttribute('data-video-sku');
code
Cart.add(sku); // Triggers OCAPI basket update
code
});
code
</script>

Explanation:

  • Interaction: Click → Cart API → Real-time basket refresh
  • Data Model: Hotspots stored as JSON in DAM

Performance: Lazy-loads hotspot metadata after video play