Home › Forums › General Issues › How to sync ACF-field with Mailchimp? › Reply To: How to sync ACF-field with Mailchimp?
The second value you listed above (field_5cdde36032dd0) is the correct format for the key for an ACF field. ACF field keys always start with field_ followed by the string that is the unique identifier.
I took a look at the Mail Chimp documentation (https://www.mc4wp.com/kb/syncing-custom-user-fields-mailchimp/) and I am not sure if the send additional fields feature (shown in your screenshot above) can be used with ACF fields. Theoretically this should work as ACF stores the custom field as part of the user meta. Try using both the field key and the field name in the send additional fields form and see if that works.
If not you could also try the filter outlined at the bottom of the Mail Chimp documentation (under the heading Advanced Fields). I haven’t tested this but 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 this info is helpful! Note I am not on ACF support staff, someone from ACF may be able to provide you with a better answer.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.