Support » Plugin: MC4WP: Mailchimp for WordPress » First and last name not syncing

  • Resolved arbolife

    (@arbolife)


    Hi,

    I somewhat successfully connected event registrations from “Events Manager” to MailChimp with this plugin. The checkbox appears on the form and the email address gets added to the correct Mailing List.

    The issue I have is that both first name and last name fields do not get passed along to MailChimp. How can this be achieved ?

    Best,
    Marc

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey Marc,

    To sync additional fields, there are 2 ways. You can use custom code. You can learn more about it at https://github.com/ibericode/mc4wp-snippets/blob/master/integrations/integration-slugs.md.

    Please note that you will need to modify the code to suit your needs as it’s just an example general purpose code.

    Another way would be to use “User Sync” plugin to sync additional fields to MailChimp.

    I hope that answers your query. Let us know if you have any further questions.

    Thread Starter arbolife

    (@arbolife)

    Hi Harish,

    Thanks, only the first option would work for me as I use anonymous bookings (no user gets created).

    So would this code for form me if my Events Manager booking form field_id is first_name and my MailChimp field name is FNAME?

    add_filter( 'mc4wp_integration_events-manager_subscriber_data', function( MC4WP_MailChimp_Subscriber $subscriber ) {
        $subscriber->merge_fields[ "FNAME" ] = sanitize_text_field( $_POST['first_name'] );
        return $subscriber;
    });

    Best,
    Marc

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey Marc,

    Yes, that should work. Did you try it yet?

    Thread Starter arbolife

    (@arbolife)

    Hi Harish,

    Great, I tested it and it works for the first name. Now I need to add the last name as well. Would that be correct ?

    dd_filter( 'mc4wp_integration_events-manager_subscriber_data', function( MC4WP_MailChimp_Subscriber $subscriber ) {
        $subscriber->merge_fields[ "FNAME" ] = sanitize_text_field( $_POST['first_name'] );
        $subscriber->merge_fields[ "LNAME" ] = sanitize_text_field( $_POST['last_name'] );
        return $subscriber;
    });

    Thanks,
    Marc

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey Marc,

    Yes, that is correct code :).

    Thread Starter arbolife

    (@arbolife)

    Thanks, it works great.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘First and last name not syncing’ is closed to new replies.