woocommerce_rest_delete_<post_type>_object

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

Description

do_action( 'woocommerce_rest_delete_<post_type>_object', (WC_Data) $object, (WP_REST_Response) $response, (WP_REST_Request) $request ); 

Parameters (3)

0. $object (WC_Data)
The deleted or trashed object.
1. $response (WP_REST_Response)
The response data.
2. $request (WP_REST_Request)
The request sent to the API.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'woocommerce_rest_delete_{$post_type}_object', $object, $response, $request ); 
The following example is for adding a hook callback.
  1. // define the woocommerce_rest_delete_<post_type>_object callback 
  2. function action_woocommerce_rest_delete_post_type_object( $object, $response, $request ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( "woocommerce_rest_delete_{$post_type}_object", 'action_woocommerce_rest_delete_post_type_object', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( "woocommerce_rest_delete_{$post_type}_object", 'action_woocommerce_rest_delete_post_type_object', 10, 3 ); 

Defined (3)

The action is defined in the following location(s).

/includes/api/class-wc-rest-products-controller.php  
  1. do_action( "woocommerce_rest_delete_{$this->post_type}_object", $object, $response, $request ); 
/includes/api/class-wc-rest-product-variations-controller.php  
  1. do_action( "woocommerce_rest_delete_{$this->post_type}_object", $object, $response, $request ); 
/includes/abstracts/abstract-wc-rest-crud-controller.php  
  1. do_action( "woocommerce_rest_delete_{$this->post_type}_object", $object, $response, $request );