Problem/Motivation

The Customer Details feature (1.2.0) only syncs forward, on the place and paid transitions. Sites that enable it after they already have orders cannot backfill name, phone and country onto existing Mautic contacts, so pre-existing customers stay without those fields until they order again.

Proposed resolution

Add a drush command commerce-mautic-connect:customer-details-sync (aliases cmccds, mautic-customer-details-sync) that iterates historical orders, groups by customer email (using each customer's most recent order for the latest billing profile), and upserts the Mautic contact via the existing CustomerDetailsSyncService. Mirrors the coupon-tags-sync command.

Options: --dry-run (preview the exact payload without writing), --limit=N, --states. Rate-limited for large backfills. Also adds a public CustomerDetailsSyncService::previewOrderContact() that shares the gate and payload logic with syncOrderContact(), so the dry-run matches the real sync exactly.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

introfini created an issue. See original summary.

  • introfini committed 689a2f23 on 1.0.x
    Issue #3608515: Add customer-details-sync drush command for historical...
introfini’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.