(hook_prefix)deleted action-hookWC 10.2.0

Fires after a single object is deleted or trashed via the REST API.

Usage

add_action( '(hook_prefix)deleted', 'wp_kama_hook_prefixdeleted_action', 10, 3 );

/**
 * Function for `(hook_prefix)deleted` action-hook.
 * 
 * @param WC_Order_Refund  $refund   The deleted object.
 * @param WP_REST_Response $response The response data.
 * @param WP_REST_Request  $request  The request sent to the API.
 *
 * @return void
 */
function wp_kama_hook_prefixdeleted_action( $refund, $response, $request ){

	// action...
}
$refund(WC_Order_Refund)
The deleted object.
$response(WP_REST_Response)
The response data.
$request(WP_REST_Request)
The request sent to the API.

Changelog

Since 10.2.0 Introduced.

Where the hook is called

Controller::delete_item()
(hook_prefix)deleted
woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php 358
do_action( $this->get_hook_prefix() . 'deleted', $refund, $response, $request );
woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php 346
do_action( $this->get_hook_prefix() . 'deleted', $note, $response, $request );
woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php 454
do_action( $this->get_hook_prefix() . 'deleted', $order, $response, $request );
woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php 364
do_action( $this->get_hook_prefix() . 'deleted', $user_data, $response, $request );

Where the hook is used in WooCommerce

woocommerce/includes/class-wc-post-data.php 73
add_action( 'woocommerce_attribute_deleted', array( __CLASS__, 'handle_global_attribute_updated' ), 10, 3 );
woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Tax.php 34
add_action( 'woocommerce_tax_rate_deleted', array( $this, 'on_tax_rate_deleted' ) );