woocommerce_rest_insert_product action-hookWC 1.0

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

Usage

add_action( 'woocommerce_rest_insert_product', 'wp_kama_woocommerce_rest_insert_product_action', 10, 3 );

/**
 * Function for `woocommerce_rest_insert_product` action-hook.
 * 
 * @param WP_Post         $post     Post data.
 * @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_product_action( $post, $request, $creating ){

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

Where the hook is called

WC_REST_Products_V1_Controller::create_item()
woocommerce_rest_insert_product
WC_REST_Products_V1_Controller::update_item()
woocommerce_rest_insert_product
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 759
do_action( 'woocommerce_rest_insert_product', $post, $request, true );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 802
do_action( 'woocommerce_rest_insert_product', $post, $request, false );

Where the hook is used in WooCommerce

woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php 71
self::add_action( 'woocommerce_rest_insert_product', array( $this, 'on_product_created_or_updated_via_rest_api' ), 100, 2 );