danielstieber/SubscribeToMailchimp

Subscribe with ADDRESS merge_field not working

ml-eds opened this issue · 2 comments

Create new list members with activated ADDRESS merge field does not work.

According to https://us1.api.mailchimp.com/schema/3.0/Lists/Members/MergeField.json ADDRESS is an object. On PHP side this would be an array within the array of parameter $merge_fields of method subscribe.

The following code effectively removes the array value within $merge_fields

          foreach ($merge_fields as $k => $v) {
                if(!empty(trim($v))) { // avoid to override data of existing leads with empty field values
                    $param['merge_fields'][$k] = $v;
                }
            }

Thanks a lot for your help! Haven't used the address field yet, but this totally makes sense. Please check my review, so I can merge it in.

Commit 6938e31 addresses your change request.