After upgrading to 4.x I wasn't able to subscribe without having the optional mailing address field at least partially filled in.

After some experimentation with the v3 API playground, it seems that an optional address field shouldn't be set at all in the mergevars unless it's filled in.

I was using mergevars_alter anyway so throwing a simple check in there and unsetting the field if nothing was specified cleared up the problem I was seeing.

Comments

soapboxcicero created an issue. See original summary.

Greg Boggs’s picture

That's great, we'd love a patch for this!

soapboxcicero’s picture

I didn't figure out where the problem originated in the mailchimp module: I just figured out what the problem was and applied a site-specific workaround in the mergevars_alter hook.

Greg Boggs’s picture

That seems like a reasonable way to fix the problem in the module, although ideally, we'd likely do it just above where the mergevar_alter hook is called instead of in the hook itself.

wmfinnegan’s picture

I believe I'm having a related issue. I've got a Mailchimp list that has an address field and when new users register they aren't being added to the Mailchimp list due to an error:
An error occurred subscribing xyz@gmail.com to list xyz. "400: Invalid Resource - Your merge fields were invalid. a:1:{i:0;O:8:"stdClass":2:{s:5:"field";s:7:"ADDRESS";s:7:"message";s:31:"Please enter a complete address";}}"

Initially address was required in the Mailchimp signup form, but I have made it optional. I've also tried leaving the Merge Fields value for the address blank, tried the token [user:field_account_address:format-mailchimp] and then added the Address Field Tokens module to try [user:field-account-address:mc-address]. I've refreshed the lists from Mailchimp and cleared all caches, but I keep getting the same error.

Addresses are required for Drupal user accounts, but I actually don't need this to pass over to Mailchimp - I just need the email to be added to the list (with their name and affiliation).

Thanks for any help...

ruscoe’s picture

The patch in this issue may also fix this one: https://www.drupal.org/node/2834402#comment-11916693

We're now unsetting any empty mergevars before sending them to MailChimp.

That patch has already been committed to the dev branch, if you'd prefer to use that rather than apply a patch.

samuel.mortenson’s picture

Status: Active » Closed (outdated)

Closing as outdated since [#11916693] is committed - if you're still having this problem on the latest 7.x-4.x release please re-open the issue.