woocommerce_rest_prepare_report_top_sellers
Filter a report top sellers returned from the API.
Allows modification of the report top sellers data right before it is returned.
Usage
add_filter( 'woocommerce_rest_prepare_report_top_sellers', 'wp_kama_woocommerce_rest_prepare_report_top_sellers_filter', 10, 3 ); /** * Function for `woocommerce_rest_prepare_report_top_sellers` filter-hook. * * @param WP_REST_Response $response The response object. * @param stdClass $top_seller 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_top_sellers_filter( $response, $top_seller, $request ){ // filter... return $response; }
- $response(WP_REST_Response)
- The response object.
- $top_seller(stdClass)
- The original report object.
- $request(WP_REST_Request)
- Request used to generate the response.
Where the hook is called
woocommerce_rest_prepare_report_top_sellers
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-top-sellers-v1-controller.php 137
return apply_filters( 'woocommerce_rest_prepare_report_top_sellers', $response, $top_seller, $request );