woocommerce_rest_prepare_report filter-hookWC 1.0

Filter a report returned from the API.

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

Usage

add_filter( 'woocommerce_rest_prepare_report', 'wp_kama_woocommerce_rest_prepare_report_filter', 10, 3 );

/**
 * Function for `woocommerce_rest_prepare_report` filter-hook.
 * 
 * @param WP_REST_Response $response The response object.
 * @param object           $report   The original report object.
 * @param WP_REST_Request  $request  Request used to generate the response.
 *
 * @return WP_REST_Response
 */
function wp_kama_woocommerce_rest_prepare_report_filter( $response, $report, $request ){

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

Where the hook is called

Controller::prepare_item_for_response()
WC_REST_Reports_V1_Controller::prepare_item_for_response()
woocommerce_rest_prepare_report
woocommerce/src/Admin/API/Reports/Controller.php 273
return apply_filters( 'woocommerce_rest_prepare_report', $response, $report, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-reports-v1-controller.php 142
return apply_filters( 'woocommerce_rest_prepare_report', $response, $report, $request );

Where the hook is used in WooCommerce

Usage not found.