Skip to content

Hook Reference

{/* AUTO-GENERATED from ../docs/hooks.md by scripts/sync-dev-docs.mjs — do not edit by hand. */}

Generated 2026-04-22 from 291a97d. Do not edit by hand — run make docs-hooks to regenerate.

Drift check: make docs-hooks-check (also runs in make qa).

Actions (10)

Filters (16)

  • Description: Fires after all virtual coupons have been applied.
  • Since: 4.0.0
  • File: includes/Cart/Traits/AppliesDiscount.php:311
  • Params: array $discounts, object $cart
  • Parameter detail:
    • $discounts (array) — Array of discount result arrays.
    • $cart (object) — The WooCommerce cart object.
  • Example:
    add_action( 'dino_discounts_after_apply_coupons', function( $discounts, $cart ) {
    // ...
    }, 10, 2 );
  • Description: Fires after a storefront template has been loaded.
  • Since: unknown
  • File: includes/Storefront/template-functions.php:90
  • Params: string $template_name, string $template_path, array $args
  • Parameter detail:
    • $template_name (string) — Relative template name.
    • $template_path (string) — Absolute path to the resolved template.
    • $args (array) — Template arguments.
  • Example:
    add_action( 'dino_discounts_after_template', function( $template_name, $template_path, $args ) {
    // ...
    }, 10, 3 );
  • Description: Fires before any virtual coupons are applied.
  • Since: 4.0.0
  • File: includes/Cart/Traits/AppliesDiscount.php:180
  • Params: array $discounts, object $cart
  • Parameter detail:
    • $discounts (array) — Array of discount result arrays from the engine.
    • $cart (object) — The WooCommerce cart object.
  • Example:
    add_action( 'dino_discounts_before_apply_coupons', function( $discounts, $cart ) {
    // ...
    }, 10, 2 );
  • Description: Fires before a storefront template is loaded.
  • Since: unknown
  • File: includes/Storefront/template-functions.php:74
  • Params: string $template_name, string $template_path, array $args
  • Parameter detail:
    • $template_name (string) — Relative template name.
    • $template_path (string) — Absolute path to the resolved template.
    • $args (array) — Template arguments.
  • Example:
    add_action( 'dino_discounts_before_template', function( $template_name, $template_path, $args ) {
    // ...
    }, 10, 3 );
  • Description: Fires after rules or settings are saved so external cache plugins (LiteSpeed, W3TC, WP Super Cache, etc.) can purge stale pages.
  • Since: 4.3.0
  • Files:
    • includes/API/RulesController.php:334
    • includes/API/SettingsController.php:131
  • Params: none
  • Example:
    add_action( 'dino_discounts_cache_flush', function() {
    // ...
    }, 10, 0 );
  • Description: No description provided in source.
  • Since: unknown
  • File: includes/Cart/Traits/AppliesDiscount.php:327
  • Params: 2 argument(s), no @param docblock
  • Example:
    add_action( 'dino_discounts_cart_discount_summary', function( $arg1, $arg2 ) {
    // ...
    }, 10, 2 );
  • Description: Fires after a single virtual discount coupon has been applied.
  • Since: 4.3.0
  • File: includes/Cart/Traits/AppliesDiscount.php:301
  • Params: string $code, array $data, object $cart
  • Parameter detail:
    • $code (string) — The virtual coupon code.
    • $data (array) — The discount data.
    • $cart (object) — The WooCommerce cart object.
  • Example:
    add_action( 'dino_discounts_discount_applied', function( $code, $data, $cart ) {
    // ...
    }, 10, 3 );
  • Description: Fires exactly once when a store moves from zero rules to one-or-more.
  • Since: 4.8.0
  • File: includes/API/RulesController.php:322
  • Params: array $sanitized_rules
  • Parameter detail:
    • $sanitized_rules (array) — The rules that were just saved.
  • Example:
    add_action( 'dino_discounts_first_rule_published', function( $sanitized_rules ) {
    // ...
    }, 10, 1 );
  • Description: Fires after the discount rules have been saved.
  • Since: 4.3.0
  • File: includes/API/RulesController.php:305
  • Params: array $sanitized_rules
  • Parameter detail:
    • $sanitized_rules (array) — The saved rules, sanitized and sorted by priority.
  • Example:
    add_action( 'dino_discounts_rules_saved', function( $sanitized_rules ) {
    // ...
    }, 10, 1 );
  • Description: Fires after the global settings have been saved.
  • Since: 4.3.0
  • File: includes/API/SettingsController.php:123
  • Params: array $settings
  • Parameter detail:
    • $settings (array) — The saved settings, sanitized.
  • Example:
    add_action( 'dino_discounts_settings_saved', function( $settings ) {
    // ...
    }, 10, 1 );
  • Description: Filter the bug-report submission endpoint URL. Return ” to suppress the “Report a bug” UI across the admin.
  • Since: 4.17.0
  • File: includes/Support/BugReport.php:73
  • Params: string $url
  • Parameter detail:
    • $url (string) — The endpoint URL.
  • Example:
    add_filter( 'dino_discounts_bug_report_url', function( $url ) {
    return $url;
    }, 10, 1 );
  • Description: Filters the map of caching plugin basenames to display names.
  • Since: 4.7.0
  • File: includes/ConflictDetector.php:142
  • Params: 1 argument(s), no @param docblock
  • Example:
    add_filter( 'dino_discounts_caching_plugins', function( $arg1 ) {
    return $arg1;
    }, 10, 1 );
  • Description: Filter the coupon display label before it is stored.
  • Since: 4.0.0
  • File: includes/Cart/Traits/AppliesDiscount.php:235
  • Params: string $label, array $discount, object $cart
  • Parameter detail:
    • $label (string) — The sanitized coupon label.
    • $discount (array) — The discount result array.
    • $cart (object) — The WooCommerce cart object.
  • Example:
    add_filter( 'dino_discounts_coupon_label', function( $label, $discount, $cart ) {
    return $label;
    }, 10, 3 );
  • Description: Filter the discount data payload before it is consumed by JS.
  • Since: 2.6.0
  • File: includes/Frontend.php:170
  • Params: array $payload
  • Parameter detail:
    • $payload (array) — Discount data for the storefront.
      • $discounts (array[]) — Each entry has ‘name’ (string) and ‘amount’ (float).
      • $currency (array) — Currency formatting data (prefix, decimals, etc.).
  • Example:
    add_filter( 'dino_discounts_discount_payload', function( $payload ) {
    return $payload;
    }, 10, 1 );
  • Description: Filter the list of enabled currency codes for the admin payload. Multi-currency plugins can hook here to add their active currencies. Each entry should be a WooCommerce currency code (e.g. ‘EUR’, ‘USD’).
  • Since: 4.3.8
  • File: includes/Admin.php:552
  • Params: string[] $codes
  • Parameter detail:
    • $codes (string[]) — Array of enabled currency codes.
  • Example:
    add_filter( 'dino_discounts_enabled_currencies', function( $codes ) {
    return $codes;
    }, 10, 1 );
  • Description: No description provided in source.
  • Since: unknown
  • File: includes/Frontend.php:156
  • Params: 1 argument(s), no @param docblock
  • Example:
    add_filter( 'dino_discounts_enrich_frontend_payload', function( $arg1 ) {
    return $arg1;
    }, 10, 1 );
  • Description: Filter the final set of applied discounts before they are returned.
  • Since: 2.5.0
  • File: includes/Engine/RulesEngine.php:521
  • Params: array $applied_discounts, \WC_Cart $cart, array $context
  • Parameter detail:
    • $applied_discounts (array) — Array of discount result arrays.
    • $cart (\WC_Cart) — The WooCommerce cart object.
    • $context (array) — Evaluation context (currency, country, cart_total).
  • Example:
    add_filter( 'dino_discounts_evaluated_discounts', function( $applied_discounts, $cart, $context ) {
    return $applied_discounts;
    }, 10, 3 );
  • Description: Filters the map of incompatible plugin basenames to display names.
  • Since: 4.2.0
  • File: includes/ConflictDetector.php:109
  • Params: 1 argument(s), no @param docblock
  • Example:
    add_filter( 'dino_discounts_incompatible_plugins', function( $arg1 ) {
    return $arg1;
    }, 10, 1 );
  • Description: Filter the inline JSON string before it is embedded in
  • Since: 2.6.0
  • File: includes/Frontend.php:443
  • Params: string $json, array $payload
  • Parameter detail:
    • $json (string) — JSON-encoded discount payload.
    • $payload (array) — Raw payload array before encoding.
  • Example:
    add_filter( 'dino_discounts_inline_script_data', function( $json, $payload ) {
    return $json;
    }, 10, 2 );
  • Description: Filter the resolved template path.
  • Since: unknown
  • File: includes/Storefront/template-functions.php:47
  • Params: string $template, string $template_name
  • Parameter detail:
    • $template (string) — Absolute path to the template file.
    • $template_name (string) — Relative template name that was requested.
  • Example:
    add_filter( 'dino_discounts_locate_template', function( $template, $template_name ) {
    return $template;
    }, 10, 2 );
  • Description: Filter the complete nudge HTML before output.
  • Since: unknown
  • File: includes/Storefront/SpendMoreNudge.php:196
  • Params: string $html, array $rule, float $delta, string $context
  • Parameter detail:
    • $html (string) — The generated nudge HTML.
    • $rule (array) — The matched discount rule.
    • $delta (float) — The gap to the next threshold.
    • $context (string) — ‘mini’ or ‘cart’.
  • Example:
    add_filter( 'dino_discounts_nudge_html', function( $html, $rule, $delta, $context ) {
    return $html;
    }, 10, 4 );
  • Description: Filter the set of candidate nudge rules before the closest is chosen. Each element is array{rule, delta, metric, next_tier}.
  • Since: unknown
  • File: includes/Storefront/SpendMoreNudge.php:289
  • Params: array $candidates, string $context
  • Parameter detail:
    • $candidates (array) — Eligible rules with their deltas.
    • $context (string) — ‘mini’ or ‘cart’.
  • Example:
    add_filter( 'dino_discounts_nudge_rules', function( $candidates, $context ) {
    return $candidates;
    }, 10, 2 );
  • Description: Filter the performance monitor instance used across runtime services. Returning a PerformanceMonitor instance overrides the default singleton. Returning null keeps the default singleton behavior.
  • Since: 4.12.0
  • File: includes/Diagnostics/PerformanceMonitor.php:116
  • Params: PerformanceMonitor|null $monitor
  • Parameter detail:
    • $monitor (PerformanceMonitor|null) — Current monitor override (default null).
  • Example:
    add_filter( 'dino_discounts_performance_monitor', function( $monitor ) {
    return $monitor;
    }, 10, 1 );
  • Description: Override the current user for rule evaluation (used by the preview/debug API to inject a mock role).
  • Since: 4.7.0
  • File: includes/Engine/RuleMatcher.php:145
  • Params: \WP_User|object|null $resolved_user
  • Parameter detail:
    • $resolved_user (\WP_User|object|null) — The resolved user object.
  • Example:
    add_filter( 'dino_discounts_preview_user', function( $resolved_user ) {
    return $resolved_user;
    }, 10, 1 );
  • Description: Filter the map of discount type keys to strategy class names. Add custom discount types by appending to the returned array. Each class must implement DiscountStrategyInterface.
  • Since: 3.0.1
  • File: includes/Engine/RulesEngine.php:1000
  • Params: array $strategy_map, RulesEngine $engine
  • Parameter detail:
    • $strategy_map (array) — Associative array of type => class name.
    • $engine (RulesEngine) — The current RulesEngine instance.
  • Example:
    add_filter( 'dino_discounts_strategies', function( $strategy_map, $engine ) {
    return $strategy_map;
    }, 10, 2 );
  • Description: Filter the result of the targeting tree evaluation for a rule. Allows developers to override or log the targeting decision.
  • Since: 3.0.1
  • File: includes/Engine/RuleMatcher.php:243
  • Params: bool $targeting_result, array $rule, array $context
  • Parameter detail:
    • $targeting_result (bool) — Whether the targeting tree matched.
    • $rule (array) — The full discount rule being evaluated.
    • $context (array) — Evaluation context (currency, country, cart, etc.).
  • Example:
    add_filter( 'dino_discounts_targeting_result', function( $targeting_result, $rule, $context ) {
    return $targeting_result;
    }, 10, 3 );