0

I'm trying to add several fields to a list in Mailchimp. This code is working, except 'FNAME', 'LNAME', and 'ADDRESS' aren't inserting (showing up blank in list after checking Mailchimp site). 'PHONE' and 'SIGNUPLINK' are inserting. Is there a formatting issue, or other?

        $Mailchimp = new Mailchimp( $api_key );
        $Mailchimp_Lists = new Mailchimp_Lists( $Mailchimp );

        $l_merge_vars = array( 
            'FNAME'     => $l_fname,
            'LNAME'     => $l_lname,
            'ADDRESS'   => $l_addresscombo,
            'PHONE'     => $l_phone,
            'SIGNUPLINK' => $l_signuplink
        );

       $l_subscriber = $Mailchimp_Lists->subscribe(
            $list_id,
            array('email' => $l_email), // 
            $l_merge_vars ,
            'html', 
            false,     // 
            true        // 
        );

'EMAIL' is also working.

codr
  • 889
  • 3
  • 13
  • 22

1 Answers1

0

Most likely (without knowing how the actualy setup looks alike), you have to set them up on MailChimp first, before they are being picked up. There's even a tutorial video for custom fields; one can also set default values for them or hide them from the signup form.


$merge_vars may need a field MM1 which is the list ID.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • Thank you for messaging; they are set up on Mailchimp as text fields; – codr May 23 '20 at 02:48
  • The mere problem is that API v2 is obsolete and so one can't even find documentation or examples on their site; migrating to API v3 would make their v3 documentation applicable. – Martin Zeitler May 23 '20 at 03:13