Home › Forums › Quform WordPress › Mailchimp questions
- This topic has 7 replies, 2 voices, and was last updated 2 years, 8 months ago by veganwebagency.
- AuthorPosts
- February 26, 2022 at 8:35 am #34047veganwebagencyParticipant
Hello,
We would like to ask you a few questions regarding your Mailchimp add on plugin:
Overwriting data
If we specify all the fields in the settings but some of them aren’t mandatory we got a problem of overwriting with empty data. So if someone has his phone number entered in Mailchimp and fills out the form again with an empty phone numer it’s gone in Mailchimp.
Is there an option to ignore empty values and only send entered?Custom Merge Fields
Same problem with the address fields in your custom filter.
If he only fills out “addr” we don’t want that Mailchimp removes the values of the other fields if it has some.
add_filter('quform_mailchimp_integration_merge_fields_1', function (array $mergeFields, Quform_Form $form) {$mergeFields['ADDRESS'] = [
'addr1' => $form->getValueText('quform_1_11'),
'city' => $form->getValueText('quform_1_14'),
'zip' => $form->getValueText('quform_1_12'),
'country' => 'CH'
];
return $mergeFields;
}, 10, 2);
Pass form value as tag
We would like to transfer a value that is selected in a select field in the form as a “tag” to Mailchimp.
We tried it with “{element|id:4|category}”, but unfortunately without success.Sorry for all the questions, but you guys are the best!! 😉
Best Regards,
ChrigiMarch 1, 2022 at 10:14 am #34056AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 2, 2022 at 10:42 am #34072AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- This reply was modified 2 years, 8 months ago by Ally. Reason: Changed config to setConfig when setting tags
March 3, 2022 at 9:27 am #34081veganwebagencyParticipantHi Ally,
Thanks for the answer.
The logic with the tag is working fine 🙂
But it’s still overwriting the address data if it’s send empty.
Was it working on your side?Best Regards,
ChrigiMarch 3, 2022 at 9:50 am #34082veganwebagencyParticipantWe have tested a little more.
– If you fill in all fields and send it it works.
– If you leave all fields empty and submit it overwrites everything.
– If you fill in only one field like “addr1” nothing happens.March 4, 2022 at 9:45 am #34088AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 7, 2022 at 2:53 pm #34089veganwebagencyParticipantHi Ally,
Thank you for your clarifications.
We have implemented it as you suggested and it works fine.
Thanks a lot!
Best Regards,
ChrigiMarch 16, 2022 at 2:02 pm #34102veganwebagencyParticipantFor 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']); }
- AuthorPosts
- You must be logged in to reply to this topic.