woocommerce_rest_insert_(taxonomy) action-hookWC 1.0

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

Usage

add_action( 'woocommerce_rest_insert_(taxonomy)', 'wp_kama_woocommerce_rest_insert_taxonomy_action', 10, 3 );

/**
 * Function for `woocommerce_rest_insert_(taxonomy)` action-hook.
 * 
 * @param WP_Term         $term     Inserted Term object.
 * @param WP_REST_Request $request  Request object.
 * @param boolean         $creating True when creating term, false when updating.
 *
 * @return void
 */
function wp_kama_woocommerce_rest_insert_taxonomy_action( $term, $request, $creating ){

	// action...
}
$term(WP_Term)
Inserted Term object.
$request(WP_REST_Request)
Request object.
$creating(true|false)
True when creating term, false when updating.

Where the hook is called

WC_REST_Terms_Controller::create_item()
woocommerce_rest_insert_(taxonomy)
WC_REST_Terms_Controller::update_item()
woocommerce_rest_insert_(taxonomy)
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php 440
do_action( "woocommerce_rest_insert_{$taxonomy}", $term, $request, true );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php 529
do_action( "woocommerce_rest_insert_{$taxonomy}", $term, $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' ) );