You are here

function hook_commerce_discount_rule_build in Commerce Discount 7

Allow modules alter the rule object, with commerce discount configuration.

Parameters

RulesPlugin $rule: The rule configuration entity, passed by reference.

CommerceDiscount $commerce_discount: The commerce discount entity.

1 function implements hook_commerce_discount_rule_build()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

commerce_discount_commerce_discount_rule_build in ./commerce_discount.module
Implements hook_commerce_discount_rule_build().
1 invocation of hook_commerce_discount_rule_build()
commerce_discount_build_discount_rules in ./commerce_discount.module
Build the rules configuration for the given discounts.

File

./commerce_discount.api.php, line 81
Hooks provided by the Commerce Discount module.

Code

function hook_commerce_discount_rule_build(RulesPlugin $rule, CommerceDiscount $commerce_discount) {
  if ($commerce_discount->name == 'foo') {
    $rule
      ->action('drupal_message', array(
      'message' => 'Discount FOO was applied.',
    ));
  }
}