Hooks (optional)
The Free plugin provides these hooks. The Pro add-on uses several of them.
| Hook | Type | Purpose |
|---|---|---|
wcdr_default_rule | filter | Defaults of a new rule (add your own fields). |
wcdr_sanitize_rule | filter | Receives the sanitized rule and the submitted data before saving. |
wcdr_rule_applies | filter | Return false to stop a rule applying. Receives the rule and a context array. |
wcdr_rule_has_discount | filter | Lets a rule with a Discount Value of 0 still discount. |
wcdr_unit_discount | filter | Change the discount of one unit. The result is never more than the unit price. |
wcdr_rule_form_cards | action | Add panels to the rule form. |
wcdr_rule_list_chips | action | Add badges to the rules list. |
wcdr_free_rule_limit | filter | The maximum number of rules (default 10). |
wcdr_offline_gateways | filter | Gateways that do not get the default payment bonus (default cod, bacs, cheque). |
wcdr_upgrade_url | filter | Where the upgrade button points. |
Rules are stored in the option wcdr_discount_rules and settings in wcdr_settings.