function mailchimp_ecommerce_delete_product in Mailchimp E-Commerce 7
Deletes a product in Mailchimp.
Parameters
string $product_id: Unique ID of the product.
File
- ./
mailchimp_ecommerce.module, line 1110 - Mailchimp eCommerce core functionality.
Code
function mailchimp_ecommerce_delete_product($product_id) {
try {
$store_id = mailchimp_ecommerce_get_store_id();
if (empty($store_id)) {
throw new Exception('Cannot delete a product without a store ID.');
}
/* @var \Mailchimp\MailchimpEcommerce $mc_ecommerce */
$mc_ecommerce = mailchimp_get_api_object('MailchimpEcommerce');
$mc_ecommerce
->deleteProduct($store_id, $product_id);
} catch (Exception $e) {
mailchimp_ecommerce_log_error_message('Unable to delete product: ' . $e
->getMessage());
mailchimp_ecommerce_show_error($e
->getMessage());
}
}