You are here

function mailchimp_ecommerce_delete_customer in Mailchimp E-Commerce 7

Delete a customer from Mailchimp.

Parameters

string $customer_id: Unique id of customer.

File

./mailchimp_ecommerce.module, line 383
Mailchimp eCommerce core functionality.

Code

function mailchimp_ecommerce_delete_customer($customer_id) {
  try {
    $store_id = mailchimp_ecommerce_get_store_id();
    if (empty($store_id)) {
      throw new Exception('Cannot delete a customer without a store ID.');
    }

    /* @var \Mailchimp\MailchimpEcommerce $mc_ecommerce */
    $mc_ecommerce = mailchimp_get_api_object('MailchimpEcommerce');
    $mc_ecommerce
      ->deleteCustomer($store_id, $customer_id);
  } catch (Exception $e) {
    mailchimp_ecommerce_log_error_message('Unable to delete a customer: ' . $e
      ->getMessage());
    mailchimp_ecommerce_show_error($e
      ->getMessage());
  }
}