woocommerce_rest_pre_insert_(post_type)_object хук-фильтрWC 1.0

Filters an object before it is inserted via the REST API.

The dynamic portion of the hook name, $this->post_type, refers to the object type slug.

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

add_filter( 'woocommerce_rest_pre_insert_(post_type)_object', 'wp_kama_woocommerce_rest_pre_insert_post_type_object_filter', 10, 3 );

/**
 * Function for `woocommerce_rest_pre_insert_(post_type)_object` filter-hook.
 * 
 * @param WC_Data         $product  Object object.
 * @param WP_REST_Request $request  Request object.
 * @param bool            $creating If is creating a new object.
 *
 * @return WC_Data
 */
function wp_kama_woocommerce_rest_pre_insert_post_type_object_filter( $product, $request, $creating ){

	// filter...
	return $product;
}
$product(WC_Data)
Object object.
$request(WP_REST_Request)
Request object.
$creating(true|false)
If is creating a new object.

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

WC_REST_Products_Controller::prepare_object_for_database()
woocommerce_rest_pre_insert_(post_type)_object
WC_REST_Orders_Controller::prepare_object_for_database()
woocommerce_rest_pre_insert_(post_type)_object
WC_REST_Order_Refunds_Controller::prepare_object_for_database()
woocommerce_rest_pre_insert_(post_type)_object
WC_REST_Product_Variations_Controller::prepare_object_for_database()
woocommerce_rest_pre_insert_(post_type)_object
WC_REST_Orders_V2_Controller::prepare_object_for_database()
woocommerce_rest_pre_insert_(post_type)_object
WC_REST_Product_Variations_V2_Controller::prepare_object_for_database()
woocommerce_rest_pre_insert_(post_type)_object
WC_REST_Order_Refunds_V2_Controller::prepare_object_for_database()
woocommerce_rest_pre_insert_(post_type)_object
WC_REST_Products_V2_Controller::prepare_object_for_database()
woocommerce_rest_pre_insert_(post_type)_object
WC_REST_Coupons_V2_Controller::prepare_object_for_database()
woocommerce_rest_pre_insert_(post_type)_object
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php 798
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $product, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php 165
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $order, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php 88
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $refund, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php 317
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $variation, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php 696
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $order, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php 464
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $variation, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php 323
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $refund, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php 1262
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $product, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php 321
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $coupon, $request, $creating );

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

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