woocommerce_rest_prepare_customer
Filter customer data returned from the REST API.
Использование
add_filter( 'woocommerce_rest_prepare_customer', 'wp_kama_woocommerce_rest_prepare_customer_filter', 10, 3 ); /** * Function for `woocommerce_rest_prepare_customer` filter-hook. * * @param WP_REST_Response $response The response object. * @param WP_User $user_data User object used to create response. * @param WP_REST_Request $request Request object. * * @return WP_REST_Response */ function wp_kama_woocommerce_rest_prepare_customer_filter( $response, $user_data, $request ){ // filter... return $response; }
- $response(WP_REST_Response)
- The response object.
- $user_data(WP_User)
- User object used to create response.
- $request(WP_REST_Request)
- Request object.
Где вызывается хук
woocommerce_rest_prepare_customer
woocommerce_rest_prepare_customer
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-customers-v2-controller.php 111
return apply_filters( 'woocommerce_rest_prepare_customer', $response, $user_data, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php 560
return apply_filters( 'woocommerce_rest_prepare_customer', $response, $user_data, $request );