woocommerce_rest_insert_(post_type) action-hookWC 1.0

Fires after a single item is created or updated via the REST API.

Usage

add_action( 'woocommerce_rest_insert_(post_type)', 'wp_kama_woocommerce_rest_insert_post_type_action', 10, 3 );

/**
 * Function for `woocommerce_rest_insert_(post_type)` action-hook.
 * 
 * @param WP_Post         $post     Post object.
 * @param WP_REST_Request $request  Request object.
 * @param boolean         $creating True when creating item, false when updating.
 *
 * @return void
 */
function wp_kama_woocommerce_rest_insert_post_type_action( $post, $request, $creating ){

	// action...
}
$post(WP_Post)
Post object.
$request(WP_REST_Request)
Request object.
$creating(true|false)
True when creating item, false when updating.

Where the hook is called

WC_REST_Order_Refunds_V1_Controller::create_item()
woocommerce_rest_insert_(post_type)
WC_REST_Coupons_V1_Controller::create_item()
woocommerce_rest_insert_(post_type)
WC_REST_Coupons_V1_Controller::update_item()
woocommerce_rest_insert_(post_type)
WC_REST_Orders_V1_Controller::create_item()
woocommerce_rest_insert_(post_type)
WC_REST_Orders_V1_Controller::update_item()
woocommerce_rest_insert_(post_type)
WC_REST_Posts_Controller::create_item()
woocommerce_rest_insert_(post_type)
WC_REST_Posts_Controller::update_item()
woocommerce_rest_insert_(post_type)
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php 321
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php 330
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php 369
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php 846
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php 885
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php 216
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php 294
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );

Where the hook is used in WooCommerce

woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 51
add_action( "woocommerce_rest_insert_{$this->post_type}", array( $this, 'clear_transients' ) );
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' ) );