Contact
For Developers / Hooks (optional)
  1. Home
  2. Dynamic Discount Rules for WooCommerce
  3. For Developers
  4. Hooks (optional)
For Developers

Hooks (optional)

1 min readUpdated Nov 7, 2026

The Free plugin provides these hooks. The Pro add-on uses several of them.

HookTypePurpose
wcdr_default_rulefilterDefaults of a new rule (add your own fields).
wcdr_sanitize_rulefilterReceives the sanitized rule and the submitted data before saving.
wcdr_rule_appliesfilterReturn false to stop a rule applying. Receives the rule and a context array.
wcdr_rule_has_discountfilterLets a rule with a Discount Value of 0 still discount.
wcdr_unit_discountfilterChange the discount of one unit. The result is never more than the unit price.
wcdr_rule_form_cardsactionAdd panels to the rule form.
wcdr_rule_list_chipsactionAdd badges to the rules list.
wcdr_free_rule_limitfilterThe maximum number of rules (default 10).
wcdr_offline_gatewaysfilterGateways that do not get the default payment bonus (default cod, bacs, cheque).
wcdr_upgrade_urlfilterWhere the upgrade button points.

Rules are stored in the option wcdr_discount_rules and settings in wcdr_settings.