I have a webform which is doing fine sending most types of data to Mailchimp. However, I have postal addresses (constructed as individual fields in Webform) which I want to send to Mailchimp. What merge tag do I use?
The overall merge tag in Mailchimp is ADDRESS. I took a look at the Mailchimp API documentation and found the fields seem to be listed there under "contact":
- address1
- address2
- city
- state
- zip
- country
I've tried various combinations such as:
ADDRESS|post_code
ADDRESS:ZIP|post_code
ADDRESS:zip|post_code
ADDRESS{zip}|post_code
...etc, etc - but can't get any data into the address field.
Any suggestions please?
Comment | File | Size | Author |
---|---|---|---|
#16 | interdiff_5-16.txt | 1018 bytes | mrshowerman |
#16 | 2385763-address-merge-field-16.patch | 716 bytes | mrshowerman |
#15 | broken-page-on-submit-webforms-to-mailchimp.pdf | 71.03 KB | amadhav1 |
Comments
Comment #1
adam_b CreditAttribution: adam_b commentedAfter a lot of back-and-forth with MailChimp, they pointed me to this page which says you need to use double spaces to separate address elements. However, I've tried that and it still doesn't work.
Their only other suggestion is to use individual fields - which gets the info to MailChimp OK but has nasty effects further down the line.
Has anybody ever managed to get data into the MailChimp Address field? Am I doing something else wrong? Or is there a bug somewhere?
Comment #2
dalemoore CreditAttribution: dalemoore commentedWere you able to get the Address field into MailChimp? I've been trying to figure this out for a week with no luck.
Comment #3
adam_b CreditAttribution: adam_b commentedNo - I had to use individual fields in the end :(
Comment #4
junaidpvWe are also having issue with sending Address field values to MaillChimp. It is the value we use in "Merge vars" settings of "MailChimp" handler for the webform:
I debugged and verified it building correct array structure from above yaml format. MailChimp contacts get values for LNAME, FNAME, PHONE. But it does not get values for address field.
Comment #5
junaidpvFound my above configuration did not work because the webform handler plugin using array_filter on mergevars. Which of course did not work for multi dimensional array. Removing array_filter fixed it. It now send the address field data to MailChimp service.
Comment #6
adam_b CreditAttribution: adam_b commentedGlad to see someone sorted this, even if it's six years later ;)
Comment #7
lomale@bluewin.ch CreditAttribution: lomale@bluewin.ch as a volunteer and commentedHi I'm coming in to this
because I have the same problem.
Mailchimp does not accept - the webform values out of
address
address_2
city
state_province
postal_code
country
to Mailchimp
address1
address2
city
state
zip
country
now Junaidpv can you tell me where you applied the patch. I'm not familiar with patches.
I would appreciate a lot for your help.
Comment #8
lomale@bluewin.ch CreditAttribution: lomale@bluewin.ch as a volunteer and commentedComment #9
junaidpv@lomale
Please put the patch file within "webform_mailchimp" module directory.
Guessing you already have GIT installed. Run this command to check if the patch will apply:
git apply --check -v 2385763-remove-filtering.patch
If it does not give any error, then run:
git apply -v 2385763-remove-filtering.patch
Comment #10
lomale@bluewin.ch CreditAttribution: lomale@bluewin.ch as a volunteer and commentedHI junaidpy
Thanks for replying.
I'm just a user and I struggle with all these technical issues. git - drush - composer.
I just made it installing composer and using it.
Is there an way to install it using composer??
or can you tell me in which file I could paste these lines manually.
I know this sounds weird. I'm just a user.
Thanks for your further help.
lomale
Comment #11
lomale@bluewin.ch CreditAttribution: lomale@bluewin.ch as a volunteer and commentedOK I just checked
The code should come into somewhere in the file
WebformMailChimpHandler.php
which line and how??
OR could you put it into it manually and send it as file.
So I would copy back the file.
I would appreciate a lot.
Thanks.
lomale
Comment #12
junaidpv@lomale,
I re-read your original statement. I see you having issues with fields other than address fields, so the patch is unlikely to fix the problem for you.
Anyway, please try sending your file to me. I will try to help. Please use contact form available in my profile https://www.drupal.org/u/junaidpv
Comment #13
lomale@bluewin.ch CreditAttribution: lomale@bluewin.ch as a volunteer and commentedHI All
Even copying the patch on #5 the into WebformMailChimpHandler.php round Line 320 manually
= replacing the line 320 with
mailchimp_subscribe($configuration['list'], $email, $mergevars, $configuration['interest_groups'], $double_optin);
worked for me.
litte difference. I had to take away the Quotation marks
compared to #4
FNAME: [webform_submission:values:first_name]
LNAME: [webform_submission:values:last_name]
PHONE: [webform_submission:values:phone]
ADDRESS:
addr1: [webform_submission:values:your_address:address]
Thanks junaidpv
Comment #14
Todd Zebert CreditAttribution: Todd Zebert at Miles commentedI had this same issue, so thanks all this was helpful. Turns out my code was never going to work as I was trying to populate *just* Country as MC enforces mandatory address subfields, so in case anyone else gets bit by this:
https://mailchimp.com/developer/marketing/docs/merge-fields/
Comment #15
amadhav1 CreditAttribution: amadhav1 commentedI'm having the same issue, this is what I have:
delivery_address(section)
address_1
address_2
city
province
postal_code
country_code
to Mailchimp
addr_1
addr_2
city
state
zip
country
This is what I have in my webforms handler:
ADDRESS:
addr1: [webform_submission:values:delivery_address:address_1]
addr2: [webform_submission:values:delivery_address:address_2]
city: [webform_submission:values:delivery_address:city]
state: [webform_submission:values:delivery_address:province]
zip: [webform_submission:values:delivery_address:postal_code]
country: [webform_submission:values:delivery_address:country_code]
Even after I added patch on #5, when I try and submit I get errors. The Address breaks it, it looks like it is treating every sub-field as a separate address field.
Thanks,
Aaron
Comment #16
mrshowermanRe-roll of #5.
Comment #17
lomale@bluewin.ch CreditAttribution: lomale@bluewin.ch as a volunteer and commentedHi im back
As mentioned in #13
litte difference. I had to take away the Quotation marks
compared to #4
FNAME: [webform_submission:values:first_name]
LNAME: [webform_submission:values:last_name]
PHONE: [webform_submission:values:phone]
ADDRESS:
addr1: [webform_submission:values:your_address:address]
But now running Drupal 9.59 and Webform Mailchimp 8.x-5.10
it only works with Quotes
FNAME: '[webform_submission:values:vorname]'
LNAME: '[webform_submission:values:name]'
ANREDE: '[webform_submission:values:gender]'
TITEL: '[webform_submission:values:titel_beruf]'
PHONE: '[webform_submission:values:phone]'
ADDRESS:
addr1: '[webform_submission:values:address:address]'
city: '[webform_submission:values:address:city]'
state: '[webform_submission:values:address:state_province]'
zip: '[webform_submission:values:address:postal_code]'
country: '[webform_submission:values:address:country]'
so it works again.
Comment #18
solarDog CreditAttribution: solarDog commentedDrupal 10.2.2
Webform Mailchimp 8x5.10
I am having similar issues with mapping my webform (6.2) address fields to the mailchimp Address.
I have tried patch from #16 with no success. The contact does not come into mailchimp using the patch, so I have reverted.
Does not seem to make a difference if I use quotes or not.
Everything but the address comes into with the Mailchimp contact. Does anyone have any insight into why this would be happening?
EDIT/UPDATE: I was able to get this working by indenting the addr1, city, state,zip like so.
Hope this helps someone else.