woocommerce_rest_insert_(post_type)_object action-hook . WC 1.0
Fires after a single object is created or updated via the REST API.
Usage
add_action( 'woocommerce_rest_insert_(post_type)_object', 'action_function_name_8515', 10, 3 ); function action_function_name_8515( $object, $request, $creating ){ // action... }
- $object(WC_Data)
- Inserted object.
- $request(WP_REST_Request)
- Request object.
- $creating(true|false)
- True when creating object, false when updating.
Where the hook is called
woocommerce_rest_insert_(post_type)_object
woocommerce_rest_insert_(post_type)_object
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php 207
do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, true );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php 254
do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, false );
Where in WP core the hook is used WooCommerce
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php 53
add_action( "woocommerce_rest_insert_{$this->post_type}_object", array( $this, 'clear_transients' ) );