woocommerce_rest_insert_(post_type) хук-событиеWC 1.0

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

Использование

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.

Где вызывается хук

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_Order_Refunds_V1_Controller::create_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-coupons-v1-controller.php 333
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php 372
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php 850
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php 889
do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
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/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 );

Где используется хук в WooCommerce

woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 53
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 55
add_action( "woocommerce_rest_insert_{$this->post_type}_object", array( $this, 'clear_transients' ) );
woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php 54
self::add_action( 'woocommerce_rest_insert_product', array( $this, 'on_product_created_or_updated_via_rest_api' ), 100, 2 );