You are here

function commerce_discount_commerce_discount_insert in Commerce Discount 7

Implements hook_commerce_discount_insert().

Rebuild Rules configuration.

File

./commerce_discount.module, line 378
Defines the discount and discount offer entities, bundles and functionality.

Code

function commerce_discount_commerce_discount_insert($entity) {
  if (module_exists('i18n_string')) {
    i18n_string_object_update('commerce_discount', $entity);
  }

  // We need to reload the discount afresh because some fields contain
  // serialized and empty values.
  $discount = entity_load_single('commerce_discount', $entity->discount_id);
  _commerce_discount_rebuild_rules_config(array(
    clone $discount,
  ));
}