woocommerce_rest_prepare_shipping_method
Filter shipping methods object returned from the REST API.
Использование
add_filter( 'woocommerce_rest_prepare_shipping_method', 'wp_kama_woocommerce_rest_prepare_shipping_method_filter', 10, 3 ); /** * Function for `woocommerce_rest_prepare_shipping_method` filter-hook. * * @param WP_REST_Response $response The response object. * @param WC_Shipping_Method $method Shipping method object used to create response. * @param WP_REST_Request $request Request object. * * @return WP_REST_Response */ function wp_kama_woocommerce_rest_prepare_shipping_method_filter( $response, $method, $request ){ // filter... return $response; }
- $response(WP_REST_Response)
- The response object.
- $method(WC_Shipping_Method)
- Shipping method object used to create response.
- $request(WP_REST_Request)
- Request object.
Где вызывается хук
woocommerce_rest_prepare_shipping_method
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php 163
return apply_filters( 'woocommerce_rest_prepare_shipping_method', $response, $method, $request );