Reply To: Mailchimp questions

Home Forums Quform WordPress Mailchimp questions Reply To: Mailchimp questions

#34102
veganwebagency
Participant

For all future readers, Mailchimp has now defined the “state” field as mandatory as well, so the correct code would be:


$mergeFields['ADDRESS'] = [
    'addr1' => $form->getValueText('quform_1_11'),
    'city' => $form->getValueText('quform_1_14'),
    'state' => $form->getValueText('quform_1_15'),
    'zip' => $form->getValueText('quform_1_12'),
    'country' => 'CH'
];

if (empty($mergeFields['ADDRESS']['addr1']) || empty($mergeFields['ADDRESS']['city']) || empty($mergeFields['ADDRESS']['state']) || empty($mergeFields['ADDRESS']['zip'])) {
    unset($mergeFields['ADDRESS']);
}

Be inspired. © 2020 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy