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_Product      $product An object representing a single item prepared for inserting or updating the database.
 * @param WP_REST_Request $request Request object.
 *
 * @return WC_Product
 */
function wp_kama_woocommerce_rest_pre_insert_post_type_filter( $product, $request ){

	// filter...
	return $product;
}
$product(WC_Product)
An object representing a single item prepared for inserting or updating the database.
$request(WP_REST_Request)
Request object.

Where the hook is called

WC_REST_Products_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_Webhooks_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_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)
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 728
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $product, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php 298
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $coupon, $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-orders-v1-controller.php 502
return apply_filters( "woocommerce_rest_pre_insert_{$this->post_type}", $order, $request );
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 );

Where the hook is used in WooCommerce

Usage not found.