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.
// SFRA middleware for quote validationserver.post('ConvertQuoteToOrder', (req, res) => {const basket = req.querystring.basketId;const quoteValid = checkQuoteApproval(basket); // Custom logicif (quoteValid) {ocapi.post(`baskets/${basket}/convert-to-order`).then(order => {res.json(order);});} else {res.setStatusCode(403); // Reject unapproved quotes} });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.
// Einstein-enhanced search in SFRASearchModel.setSortingRule('contractPriority', (products, req) => {const accountId = req.session.raw.accountId;return products.sort((a, b) => {return a.isEntitled(accountId) ? -1 : 1; // Push entitled SKUs first});});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.
// PDP video loader (SFRA middleware)if (navigator.connection.effectiveType === '4g') {loadVideo('product-demo', { resolution: '480p', cdn: 'akamai-edge' });} else {loadVideo('product-demo', { resolution: '1080p', cdn: 'fastly-premium' });}Explanation:
- Optimization: Defers 1080p load until Wi-Fi detection.
- Use Case: Heavy machinery demo videos.
- Interaction: PDP → Network Check → CDN Switch → Einstein 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.
// Scroll-triggered tracking (Web Worker)const observer = new IntersectionObserver((entries) => {if (entries[0].isIntersecting) {self.postMessage({ event: 'video_impression', videoId: 'xyz' });}}, { threshold: 0.8 });Explanation:
- Optimization: Offloads analytics to background thread
- Use Case: Post-view quote requests
- Interaction: PDP → IntersectionObserver → Web Worker → Einstein → CPQ
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).
// Adaptive bitrate switching (PDP)const bandwidth = navigator.connection.downlink;const videoSrc = bandwidth > 5 ? '4k-stream.mpd' : 'hd-stream.mpd';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.
<!-- Video hotspot with SKU binding --><video data-product-id="prod123"><track kind="metadata" src="hotspots.vtt" /></video><script>document.querySelector('video').addEventListener('click', (e) => {const sku = e.target.getAttribute('data-video-sku');Cart.add(sku); // Triggers OCAPI basket update});</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
