woocommerce_rest_prepare_report_stock_stats хук-фильтрWC 1.0

Filter a report returned from the API.

Allows modification of the report data right before it is returned.

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

add_filter( 'woocommerce_rest_prepare_report_stock_stats', 'wp_kama_woocommerce_rest_prepare_report_stock_stats_filter', 10, 3 );

/**
 * Function for `woocommerce_rest_prepare_report_stock_stats` filter-hook.
 * 
 * @param WP_REST_Response $response The response object.
 * @param WC_Product       $product  The original bject.
 * @param WP_REST_Request  $request  Request used to generate the response.
 *
 * @return WP_REST_Response
 */
function wp_kama_woocommerce_rest_prepare_report_stock_stats_filter( $response, $product, $request ){

	// filter...
	return $response;
}
$response(WP_REST_Response)
The response object.
$product(WC_Product)
The original bject.
$request(WP_REST_Request)
Request used to generate the response.

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

Controller::prepare_item_for_response()
woocommerce/src/Admin/API/Reports/Stock/Stats/Controller.php 75
return apply_filters( 'woocommerce_rest_prepare_report_stock_stats', $response, $product, $request );

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

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