woocommerce_rest_pre_insert_(post_type) filter-hookWC 1.0

Filter the query_vars used in get_items for the constructed query.

The dynamic portion of the hook name, $this->post_type, refers to post_type of the post being prepared for insertion.

Usage

add_filter( 'woocommerce_rest_pre_insert_(post_type)', 'wp_kama_woocommerce_rest_pre_insert_post_type_filter', 10, 2 );

/**
 * Function for `woocommerce_rest_pre_insert_(post_type)` filter-hook.
 * 
 * @param WC_Coupon       $coupon  The coupon object.
 * @param WP_REST_Request $request Request object.
 *
 * @return WC_Coupon
 */
function wp_kama_woocommerce_rest_pre_insert_post_type_filter( $coupon, $request ){

	// filter...
	return $coupon;
}
$coupon(WC_Coupon)
The coupon object.
$request(WP_REST_Request)
Request object.

Where the hook is called

WC_REST_Legacy_Coupons_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
WC_REST_Legacy_Orders_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
WC_REST_Webhooks_V1_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
WC_REST_Coupons_V1_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
WC_REST_Orders_V1_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
WC_REST_Products_V1_Controller::prepare_item_for_database()
woocommerce_rest_pre_insert_(post_type)
woocommerce/includes/legacy/api/class-wc-rest-legacy-coupons-controller.php 162
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $coupon, $request );
woocommerce/includes/legacy/api/class-wc-rest-legacy-orders-controller.php 222
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $order, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php 550
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $data, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php 301
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $coupon, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php 505
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $order, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 730
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $product, $request );

Where the hook is used in WooCommerce

Usage not found.