function commerce_discount_commerce_discount_delete in Commerce Discount 7
Implements hook_commerce_discount_delete().
Delete referenced commerce_discount_offer upon commerce_discount deletion.
File
- ./
commerce_discount.module, line 541 - Defines the discount and discount offer entities, bundles and functionality.
Code
function commerce_discount_commerce_discount_delete($entity) {
if (module_exists('i18n_string')) {
i18n_string_object_remove('commerce_discount', $entity);
}
$wrapper = entity_metadata_wrapper('commerce_discount', $entity);
// Delete the referenced commerce_discount_offer.
if ($wrapper->commerce_discount_offer
->value()) {
entity_delete('commerce_discount_offer', $wrapper->commerce_discount_offer
->getIdentifier());
}
}