woocommerce_rest_pre_insert_(post_type)_object
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.
Usage
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.
Where the hook is called
woocommerce_rest_pre_insert_(post_type)_object
woocommerce_rest_pre_insert_(post_type)_object
woocommerce_rest_pre_insert_(post_type)_object
woocommerce_rest_pre_insert_(post_type)_object
woocommerce_rest_pre_insert_(post_type)_object
woocommerce_rest_pre_insert_(post_type)_object
woocommerce_rest_pre_insert_(post_type)_object
woocommerce_rest_pre_insert_(post_type)_object
woocommerce_rest_pre_insert_(post_type)_object
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php 1277
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $product, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php 517
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 756
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $order, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php 327
$refund = apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $refund, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php 324
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $coupon, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php 896
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $product, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php 392
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}_object", $variation, $request, $creating );
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php 170
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 );