Black Friday: 79% off every plugin Shop the sale →

Hooks & Filters

All hooks are prefixed leet_rd_.

Filters#

FilterArgumentsPurpose
leet_rd_approve_capabilitystring $capabilityThe capability needed to approve, reject, retry, revert and stage exceptions. Default edit_shop_orders.
leet_rd_find_order_idint $order_id, string $numberReturn an order ID for a number the customer typed, for example with a sequential order number plugin. Return 0 to use the built-in lookup.
leet_rd_client_ipstring $ip, string $remoteChange the client IP used for rate limits and lookup lockouts.
leet_rd_claimed_qtyint $qty, WC_Order $order, int $item_id, int $exclude_case_idQuantity of an order item already claimed by another open case.
leet_rd_exchange_currency_supportedbool $supported, WC_Order $orderReturn true to allow an exchange on an order paid in another currency than the shop’s. Default false.
leet_rd_tracking_readersarray $readersAdd or remove tracking readers. Each reader is a callable that receives the order and returns a list of shipments.
leet_rd_status_textsarray $texts, string $statusLabel, remark and ETA text for an order status in status answers. Used when Leet Order Tracking is not active.
leet_rd_credit_adaptersarray $adaptersRegister store credit adapters (objects implementing Leet_RD_Credit_Adapter).
leet_rd_ledger_actionsarray $actionsRegister action handlers (objects implementing Leet_RD_Ledger_Action).
leet_rd_ledger_can_execute$allowed, array $proposalReturn a WP_Error to refuse executing a proposal, otherwise true. Checked at approve, at retry and under the locks.
leet_rd_ledger_can_revert$allowed, array $proposalReturn a WP_Error to refuse reverting an executed proposal, otherwise true.
leet_rd_ai_clientLeet_RD_AI_Client $clientReplace the AI client. A return value that is not an Leet_RD_AI_Client is ignored.
leet_rd_uploads_classstring $classReplace the uploads class, mainly for tests.
leet_rd_storeengine_store_urlstring $urlThe StoreEngine store URL used for license checks and updates.
leet_rd_storeengine_product_idint $product_idThe StoreEngine product ID. 0 disables licensing.
leet_rd_store_dashboard_urlstring $urlThe account link shown on the License screen.
leet_rd_storeengine_allow_localbool $allowWhether keys can be activated on local and .test sites. Default true.

Actions#

ActionArgumentsFires when
leet_rd_case_createdint $case_idA case is created.
leet_rd_case_statusint $case_id, string $from, string $to, array $contextA case changes status.
leet_rd_case_needs_decisionint $case_id, string $reason, string $originA case needs your decision and nothing of it is waiting in the queue. Reason is policy, staging_failed or replacement_order.
leet_rd_return_auth_revertedint $case_id, array $proposalA return authorization was withdrawn and its case is waiting for a decision again.
leet_rd_ledger_proposedint $id, array $proposalA proposal is created.
leet_rd_ledger_rejectedint $id, array $proposalA proposal is rejected.
leet_rd_ledger_executedint $id, array $proposal, array $resultA proposal executed.
leet_rd_ledger_revertedint $id, array $proposalAn executed proposal is reverted.
leet_rd_ledger_failedint $id, array $proposal, WP_Error $errorA proposal failed to execute.
leet_rd_settings_updatedstring $groupA settings group was saved and logged.
leet_rd_audit_failedstring $event, array $argsAn activity log write failed.

Examples#

Let a custom role approve proposals:

add_filter( 'leet_rd_approve_capability', function () {
	return 'manage_woocommerce';
} );

Support a sequential order number plugin that stores numbers in your own meta key:

add_filter( 'leet_rd_find_order_id', function ( $order_id, $number ) {
	$orders = wc_get_orders( array(
		'limit'      => 1,
		'meta_key'   => '_my_order_number',
		'meta_value' => ltrim( $number, '#' ),
		'return'     => 'ids',
	) );
	return $orders ? (int) $orders[0] : $order_id;
}, 10, 2 );

React to a finished proposal:

add_action( 'leet_rd_ledger_executed', function ( $id, $proposal, $result ) {
	error_log( 'Resolution Desk proposal ' . $id . ' executed.' );
}, 10, 3 );

The array keys of a proposal and of an execution result are internal to the ledger and are not documented as a public contract. Confirm which keys you want to promise to third parties before publishing a reference for them.

Was this article helpful?