Support

Account

Home Forums General Issues How to sync ACF-field with Mailchimp? Reply To: How to sync ACF-field with Mailchimp?

  • Hi Rawland:

    I submitted a response this morning, I think my comment was held for moderation. I kept accidentally submitting my response before I was finished typing, I think I submitted too many edits in a short time period. Here is my response again:

    The second is the correct format for your field key (field_5cdde36032dd0). All ACF field keys begin with “field_” followed by the unique identifier string.

    I checked the Mail Chimp documentation (https://www.mc4wp.com/kb/syncing-custom-user-fields-mailchimp/) and it looks like theoretically ACF fields should be able to be synced using the Send Additional Fields feature of the Mail Chimp plugin (shown in your screenshot), as ACF stores fields attached to users as user meta. Try using both the field key and the field name in the form and see if that works.

    If not you could try the filter solution outlined at the bottom of the Mail Chimp documentation under the heading Advanced Fields. Here is an example of how this filter might be used:

    
    add_filter( 'mc4wp_user_sync_subscriber_data', function( $subscriber, $user ) {
        //Get the user id
        $user_id = $user->ID;
        //Format the user id for ACF
        $acf_user_id = 'user_' . $user_id;
        //Get the value for your custom field using the field name
        $my_custom_field_value = get_field('my_custom_field_name', $acf_user_id);
        //Sync the custom field value with the Mail Chimp field you want to store it in
        $subscriber->merge_fields['MY_FIELD'] = $my_custom_field_value;
        return $subscriber;
    }, 10, 2 );
    

    Hope that information is helpful! I am just a community member and am not part of ACF staff (I am just pawn in game of ACF). Someone from the staff may be able to better advise you if this info doesn’t work.