Skip to main content
Drupal Commerce → SalesforceIntegration guide

Connecting Drupal Commerce to Salesforce

Drupal Commerce is self-hosted commerce inside a CMS built for complex content, which means the store is one part of a much larger site you fully control. Sending conversions into Salesforce rather than out of it is how marketing data reaches the place sales actually works. The join between them succeeds or fails on one thing: whether the Lead or Contact identity reaches the Drupal Commerce order before the conversion happens, because Salesforce can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Drupal Commerce to Salesforce: B2B orders onto the account

This pair suits a Drupal Commerce store selling to businesses a sales team manages. A first purchase from a paid click becomes a closed-won Salesforce Opportunity with order total, currency, order ID and the stored click identifier; repeat orders go to a custom order object on the Account. Match guest emails against Contacts, then Leads, and sync cancellations and refunds.

This pair makes sense when the Drupal store sells to businesses a sales team also manages: reorders, quotes, trade accounts. The order should then land on the Salesforce Account and Contact it belongs to, and the ad click that started the relationship should already sit on the original Lead. Drupal has a long-standing Salesforce Suite module that maps Drupal entities to Salesforce objects; check whether its current release handles commerce_order on your Drupal version before writing a custom sync.

Decide what an order becomes. For a first purchase from a paid click, an Opportunity created closed-won with the order total, currency and order ID is the object offline conversion imports can read later. For repeat orders on an existing account, a custom order object related to the Account avoids flooding the pipeline with Opportunities nobody worked. Map the click identifier stored on the Drupal order to a custom field on that first record only.

Salesforce matching rules decide whether a guest checkout email creates a new Lead or finds the existing Contact, and with Drupal guest checkout this produces duplicates quickly. Match on email against Contacts first, then Leads, inside your sync, and log what matched. Drupal order state changes to canceled or refunded must update the Salesforce record too, or closed-won value stays at what the buyer first paid.

Drupal Commerce → Salesforce · what breaks

Why this join usually fails — Drupal Commerce → Salesforce

  1. 01

    The Lead or Contact identity never reaches Drupal Commerce

    Drupal's internal page cache and any reverse proxy in front of it serve stored renders, so anything relying on dynamically rendered values fails intermittently. Multilingual and multi-site installs add further paths where the capture code may simply not run.

  2. 02

    Configurable workflow states nobody agreed on

    Drupal Commerce lets each install define its own order states. Two people reporting on the same store routinely count different states and never reconcile.

  3. 03

    Writes that succeed and change nothing

    Field-level security, validation rules and required-field constraints can reject a write while the API reports success. Open the record and look rather than trusting the response.

  4. 04

    Nothing reconciles afterwards

    Check the record in Salesforce itself, not the API response. Then confirm the value survives Lead conversion onto the Contact, Account and Opportunity — the mapping is separate and is usually the thing that was missed.

Drupal Commerce → Salesforce · the fix

What working looks like — Drupal Commerce → Salesforce

  • The Lead or Contact identity on every order

  • Conversions arriving in Salesforce

    The marketing context appears on the record and flows into the opportunity, where sales and reporting can both use it.

  • Reconciled against the source

Drupal Commerce → Salesforce · architecture

How Drupal Commerce and Salesforce actually connect

  1. 1

    Drupal Commerce holds the truth

    You own the database, so the truth is exactly as good as the query. Pin down which order states count as revenue before comparing anything — Drupal's workflow states are configurable per install, so no two sites agree by default.

  2. 2

    Salesforce needs a click to match

    Salesforce needs a resolvable record and a custom field to write to. Field-level security and validation rules can silently reject writes, which is a Salesforce-specific failure that returns success at the API level and changes nothing.

  3. 3

    The identifier is the bridge

    The Lead or Contact identity, captured at the visit and carried into the Drupal Commerce order.

  4. 4

    The event source decides reliability

    Fire server-side from the hook rather than the checkout completion template, which is cacheable and may not execute anything.

  5. 5

    Deduplication at the destination

    Salesforce deduplicates according to whatever matching rules your org has configured, which vary enormously between instances. Duplicate Leads are the standard failure and merging them afterwards is manual work.

Drupal Commerce → Salesforce · normal or broken

Working vs. broken, side by side — Drupal Commerce → Salesforce

Normal, not a fault

  • The Lead or Contact identity present on the order

  • Sent from the Drupal Commerce order placement hook

  • Deduplicated correctly

    Salesforce deduplicates according to whatever matching rules your org has configured, which vary enormously between instances. Duplicate Leads are the standard failure and merging them afterwards is manual work.

  • Reconciles with the source

Actually broken

  • The Lead or Contact identity missing on most records

    Drupal's internal page cache and any reverse proxy in front of it serve stored renders, so anything relying on dynamically rendered values fails intermittently. Multilingual and multi-site installs add further paths where the capture code may simply not run.

  • Sent from the browser

    Drupal Commerce lets each install define its own order states. Two people reporting on the same store routinely count different states and never reconcile.

  • Counted twice, or not at all

    Field-level security, validation rules and required-field constraints can reject a write while the API reports success. Open the record and look rather than trusting the response.

  • Nobody has reconciled it

Drupal Commerce → Salesforce · diagnose

Diagnostic order — Drupal Commerce → Salesforce

  1. 01

    Count orders carrying the Lead or Contact identity

  2. 02

    Follow one real conversion end to end

  3. 03

    List the order states in use and agree which count as revenue

    Do this before any technical work — it resolves more Drupal Commerce disputes than any code change.

  4. 04

    Write a test value and open the record in the UI

    The API saying it worked and the field actually holding the value are different things in Salesforce more than anywhere else.

  5. 05

    Read the match rate, not the success message

    Check the record in Salesforce itself, not the API response. Then confirm the value survives Lead conversion onto the Contact, Account and Opportunity — the mapping is separate and is usually the thing that was missed.

Drupal Commerce → Salesforce · prove

How it gets proven — Drupal Commerce → Salesforce

Source of truth

Drupal's commerce_order records in your own database, filtered to completed states.

  • The Lead or Contact identity confirmed present on a live order.
  • A test value confirmed present on the record in the UI, and confirmed to survive Lead conversion.
  • Order field data confirmed populated on an order placed through a fully warmed cache as an anonymous visitor.

Drupal Commerce → Salesforce · free audit

What we check in the free audit

  • Count orders carrying the Lead or Contact identity
  • Follow one real conversion end to end
  • List the order states in use and agree which count as revenue
  • Write a test value and open the record in the UI
  • Read the match rate, not the success message

Checked against

Drupal's commerce_order records in your own database, filtered to completed states.

Get my free conversion tracking audit

Free30 minutesNo obligation

Drupal Commerce → Salesforce · when not to buy

When you don't need this — Drupal Commerce → Salesforce

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the Lead or Contact identity.
  • If your Drupal site is content-only with commerce elsewhere, work at the commerce system instead — this is the wrong layer.
  • If your Salesforce org is administered by a team you cannot get time with, scope their availability before starting — this build is usually blocked on admin access rather than on the work.

Drupal Commerce → Salesforce · what we deliver

What gets built — Drupal Commerce → Salesforce

  • Identifier capture into Drupal Commerce

    Capture the identifier and persist it as order field data through a hook on order placement, server-side, so it never depends on what the cache served.

  • Event source: the Drupal Commerce order placement hook

    Fire server-side from the hook rather than the checkout completion template, which is cacheable and may not execute anything.

  • Dispatch to Salesforce

    API writes to the Lead or Contact record, or a platform event, carrying the marketing context as custom field values.

  • Reversals where they exist

    Order state transitions to refunded or cancelled are recorded and can drive reversals.

Written guarantee

95%+ tracking accuracy

Measured against Drupal's commerce_order records in your own database, filtered to completed states.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Drupal Commerce → Salesforce questions, answered

The Salesforce Suite module maps Drupal entities to Salesforce objects. Confirm it supports Commerce order entities in your versions, and check field writes in the Salesforce UI rather than the sync log.

Free · 30 min

Get Drupal Commerce and Salesforce joined properly

Free30 minutesNo obligation