Here is the HTML body content for the "Hooks & Filters" documentation page:
```html
Hooks & Filters
WalletPro exposes over 80 action hooks and filter hooks throughout its codebase, giving developers precise control over wallet behavior, UI output, ledger logic, reward calculations, and integrations without modifying plugin files.
DeveloperPHPWooCommerceExtensibilityCustomization
Overview
All WalletPro hooks follow WordPress conventions. Actions use do_action() and filters use apply_filters(). Hook names use the walletpro_ prefix to avoid collisions with WooCommerce core or other plugins.
Hooks are organized into the following functional areas:
All hooks documented here are considered stable public API. Hooks marked @internal in source docblocks are subject to change without notice and should not be used in production extensions.
Balance & Ledger Hooks
Actions
Hook
Arguments
Description
walletpro_before_credit
$user_id, $amount, $currency, $reason
Fires immediately before a credit is written to the ledger. Throw a WalletPro_Exception here to abort the credit.
walletpro_after_credit
$user_id, $amount, $currency, $ledger_entry_id
Fires after a successful credit. The ledger entry is already committed and HMAC-chained at this point.
walletpro_before_debit
$user_id, $amount, $currency, $order_id
Fires before an atomic debit. Return value is not used; throw to abort.
Fires before WalletPro sends a transactional email. Return nothing; throw WalletPro_Exception to suppress the send.
walletpro_email_sent
$notification_type, $user_id, $to_address
Fires after a transactional email is dispatched.
walletpro_webhook_before_dispatch
$event_name, $payload, $endpoint_url
Fires before a signed outbound webhook is sent.
walletpro_webhook_dispatched
$event_name, $payload, $http_response_code
Fires after a webhook dispatch attempt, whether successful or not.
Filters
Hook
Default
Arguments
Description
walletpro_email_subject
$subject
$subject, $notification_type, $user_id
Override the subject line for any WalletPro transactional email.
walletpro_email_args
$args
$args, $notification_type, $user_id
Modify the template variables available to a WalletPro email template.
walletpro_webhook_payload
$payload
$payload, $event_name
Modify the payload array before it is JSON-encoded and signed for dispatch.
walletpro_webhook_headers
$headers
$headers, $event_name, $endpoint_url
Add or modify HTTP headers sent with outbound webhook requests.
✅
All WalletPro notification types are listed in WalletPro\Notifications\Types. Common values include credit_received, debit_posted, topup_complete, transfer_sent, transfer_received, withdrawal_approved, code_redeemed, cashback_awarded, and autoreload_failed.
Spending Limits & Velocity Filters
Hook
Default
Arguments
Description
walletpro_spending_limit_amount
$limit
$limit, $user_id, $period, $currency
Override the configured spending limit for a user at runtime. $period is daily, weekly, or monthly.
walletpro_velocity_cap_count
$cap
$cap, $user_id, $window_seconds
Override the maximum number of wallet transactions allowed per window.
walletpro_spending_limit_enabled
true
$enabled, $user_id
Return false to exempt a user from spending limit enforcement entirely.
Multi-Currency Filters
Hook
Default
Arguments
Description
walletpro_active_currencies
$currencies
$currencies, $user_id
Control which currency wallets are active for a given user. Return an array of ISO 4217 codes.
walletpro_default_currency
get_woocommerce_currency()
$currency, $user_id
Override the default wallet currency for a user. This affects which balance is shown on the checkout page.
walletpro_exchange_rate
1.0
$rate, $from_currency, $to_currency
Provide a live exchange rate for cross-currency operations. WalletPro does not fetch rates automatically; return a float from your exchange rate source.
WalletPro registers its own internal callbacks at priority 10. Use priority 5 to run before WalletPro's own logic, or priority 20 or higher to run after it. For filters that modify amounts, run at priority 5 to ensure the modified value is what WalletPro acts on.
⚠️
Never call WalletPro\Ledger::credit() or WalletPro\Ledger::debit() directly inside a walletpro_before_credit or walletpro_before_debit hook, this will cause recursive ledger writes. Use walletpro_after_credit or walletpro_after_debit if you need to issue a follow-on transaction.
Discovering All Registered Hooks
You can enumerate every WalletPro hook registered in the current request using wp wallet doctor --hooks from the WP-CLI command or by searching the plugin source for the walletpro_ prefix:
# List all WalletPro hooks from CLI
wp wallet doctor --hooks
# Search plugin source for hook names
grep -rn "do_action\|apply_filters" wp-content/plugins/walletpro/src/ \
| grep "walletpro_" \
| awk -F: '{ print $1, $3 }'
The wp wallet doctor --hooks output includes the hook name, argument count, and the file and line number where it fires, which is the fastest way to confirm hook availability in the installed version.