Skip to content

Hook Reference

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

Generated 2026-05-19 from 4ea77d0d. Do not edit by hand — run make docs-hooks to regenerate.

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

Actions (11)

Filters (19)

  • Description: Fires after all virtual coupons have been applied.
  • Since: 4.0.0
  • File: includes/Cart/Traits/AppliesDiscount.php:385
  • 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 );

dino_discounts_allocator_unexpected_negative

Section titled “dino_discounts_allocator_unexpected_negative”
  • Description: Fires when the per-item allocator emits a negative value larger than the FP-noise band — i.e. something that smells like a real sign-flip or accumulator regression rather than rounding drift. Always paired with a clamp to 0.0 in the return value so the negative never reaches the cart; this hook exists purely for observability.
  • Since: 4.16.35
  • File: includes/Engine/Strategy/AbstractStrategy.php:373
  • Params: float $amount
  • Parameter detail:
    • $amount (float) — The unexpected negative value the allocator produced.
  • Example:
    add_action( 'dino_discounts_allocator_unexpected_negative', function( $amount ) {
    // ...
    }, 10, 1 );
  • Description: Fires before any virtual coupons are applied.
  • Since: 4.0.0
  • File: includes/Cart/Traits/AppliesDiscount.php:189
  • 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/AbstractController.php:192
    • includes/StarterData/ResetManager.php:369
  • 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:401
  • 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:375
  • 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:511
  • 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
  • Files:
    • includes/API/RulesController.php:494
    • includes/StarterData/ResetManager.php:150
  • Params: array $sanitized_rules
  • Parameter detail:
    • $sanitized_rules (array) — The saved rules, sanitized; array order is the merchant’s admin reorder (the engine’s evaluation order — no priority sort is applied).
  • 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:144
  • 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 destination email for the bug-report silent fallback. When the Worker is unreachable or not configured, wp_mail() sends the full report to this address so bug reports still land even if the Worker is down. Default: the Dino Discounts team alias ({@see self::FALLBACK_EMAIL}). The reporter is typically the site admin themselves and the bug is in this plugin, so routing the fallback back to admin_email would file the report into the reporter’s own inbox — never reaching the team that can fix it.
  • Since: 4.19.0
  • File: includes/API/BugReportController.php:402
  • Params: string $to, string $title, string $body
  • Parameter detail:
    • $to (string) — Destination email.
    • $title (string) — Short description supplied by the reporter.
    • $body (string) — Full report body.
  • Example:
    add_filter( 'dino_discounts_bug_report_email', function( $to, $title, $body ) {
    return $to;
    }, 10, 3 );
  • 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:68
  • 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: Filter the per-plugin checker registry. Concrete checkers must implement {@see CacheCompatPluginChecker}. Entries that are not instances of the interface are silently dropped — keeps a misconfigured filter from fatalling admin.
  • Since: 5.4.0
  • File: includes/Diagnostics/CacheCompatChecker.php:58
  • Params: CacheCompatPluginChecker[] $checkers
  • Parameter detail:
    • $checkers (CacheCompatPluginChecker[]) — Default registry.
  • Example:
    add_filter( 'dino_discounts_cache_compat_checkers', function( $checkers ) {
    return $checkers;
    }, 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:287
  • 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:348
  • 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 to disable the cart-UI sync layer entirely. Returning false skips the enqueue — useful when a third-party theme or plugin’s own cart layer conflicts with our subscriber (Store API middleware, fragment listeners, mini-cart drawer injection, parallel cart-totals refresh). One-line mu-plugin disables surgically: add_filter( ‘dino_discounts_enable_cart_ui_sync’, ‘__return_false’ );
  • Since: REFACTOR-CART-UI-SYNC-LAYER
  • File: includes/Frontend.php:436
  • Params: bool $enabled
  • Parameter detail:
    • $enabled (bool) — Default true.
  • Example:
    add_filter( 'dino_discounts_enable_cart_ui_sync', function( $enabled ) {
    return $enabled;
    }, 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:960
  • 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:334
  • 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:710
  • 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:533
  • 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: No description provided in source.
  • Since: unknown
  • File: includes/Migrations.php:427
  • Params: 1 argument(s), no @param docblock
  • Example:
    add_filter( 'dino_discounts_migration_steps', function( $arg1 ) {
    return $arg1;
    }, 10, 1 );
  • Description: Filter the complete nudge HTML before output.
  • Since: unknown
  • File: includes/Storefront/SpendMoreNudge.php:234
  • Params: string $html, array $rule, float $delta, string $context
  • Parameter detail:
    • $html (string)
    • $rule (array) — Section-shaped rule.
    • $delta (float) — Gap to next threshold.
    • $context (string) — ‘mini’ | ‘cart’ | ‘checkout’.
  • 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.
  • Since: unknown
  • File: includes/Storefront/SpendMoreNudge.php:386
  • Params: array $candidates, string $context
  • Parameter detail:
    • $candidates (array) — Each element is { rule, delta, metric, next_tier }.
    • $context (string)
  • 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:151
  • 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:1483
  • 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 );