public function CustomerHandler::deleteCustomer in Mailchimp E-Commerce 8
@inheritdoc
Overrides CustomerHandlerInterface::deleteCustomer
File
- src/
CustomerHandler.php, line 96
Class
- CustomerHandler
- Customer handler.
Namespace
Drupal\mailchimp_ecommerceCode
public function deleteCustomer($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());
drupal_set_message($e
->getMessage(), 'error');
}
}