Skip to content

Instantly share code, notes, and snippets.

@pippinsplugins
Last active May 19, 2017 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pippinsplugins/b74ed2b4c3f97fde2a49341f39d21563 to your computer and use it in GitHub Desktop.
Save pippinsplugins/b74ed2b4c3f97fde2a49341f39d21563 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'mailchimp_sync_subscriber_data', function( MC4WP_MailChimp_Subscriber $subscriber, $user ) {
$affiliate = affiliate_wp()->affiliates->get_by( 'user_id', $user->ID );
if( ! empty( $affiliate ) ) {
$subscriber->merge_fields['MERGE6'] = $affiliate->affiliate_id;
}
return $subscriber;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment