Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Add Customer To Mailchimp
- $add_to_mailchimp = 0;
- foreach($transaction->custom_fields->custom_field as $custom_field) {
- if ((string)$custom_field->custom_field_name == "newsletter_subscribe" && (string)$custom_field->custom_field_value == "1") {
- $add_to_mailchimp = 1;
- }
- }
- if ($add_to_mailchimp) {
- require_once 'MCAPI.class.php';
- $mailchimp_api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
- $mailchimp_list_id = "xxxxxxxxxx";
- $api = new MCAPI($mailchimp_api_key);
- $merge_vars = array(
- 'FNAME' => $customer_first_name,
- 'LNAME' => $customer_last_name,
- 'OPTINIP' => (string)$transaction->customer_ip
- );
- $retval = $api->listSubscribe($mailchimp_list_id, $customer_email, $merge_vars, "html", false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement