Fires after two contact records have been merged. The primary contact has absorbed all data from the secondary, which has been deleted.
do_action( 'groundhogg/contact/merged', $contact, $other );
You will receive the primary (surviving) Contact object as the first argument, and the deleted secondary Contact object as the second.
Example
add_action( 'groundhogg/contact/merged', 'my_extension_sync_merge', 10, 2 );
/**
* Merge the two records in an external CRM after Groundhogg merges the contacts.
*
* @param \Groundhogg\Contact $contact The surviving contact.
* @param \Groundhogg\Contact $other The deleted contact.
*
* @return void
*/
function my_extension_sync_merge( $contact, $other ) {
$primary_id = $contact->get_meta( 'external_crm_id' );
$secondary_id = $other->get_meta( 'external_crm_id' );
if ( $primary_id && $secondary_id ) {
my_extension_api_request( 'POST', '/contacts/merge', [
'primary' => $primary_id,
'secondary' => $secondary_id,
] );
}
}
Was this helpful?
Let us know if this document answered your question. Thatβs the only way we can improve.
