woocommerce_rest_prepare_shipping_zone filter-hookWC 10.9.0

Filter shipping zone objects returned from the REST API.

Usage

add_filter( 'woocommerce_rest_prepare_shipping_zone', 'wp_kama_woocommerce_rest_prepare_shipping_zone_filter', 10, 3 );

/**
 * Function for `woocommerce_rest_prepare_shipping_zone` filter-hook.
 * 
 * @param WP_REST_Response $response The response object.
 * @param array            $item     The shipping zone data.
 * @param WP_REST_Request  $request  Request object.
 *
 * @return WP_REST_Response
 */
function wp_kama_woocommerce_rest_prepare_shipping_zone_filter( $response, $item, $request ){

	// filter...
	return $response;
}
$response(WP_REST_Response)
The response object.
$item(array)
The shipping zone data.
$request(WP_REST_Request)
Request object.

Changelog

Since 10.9.0 Introduced.

Where the hook is called

WC_REST_Shipping_Zones_V2_Controller::prepare_item_for_response()
woocommerce_rest_prepare_shipping_zone
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php 256
return apply_filters( 'woocommerce_rest_prepare_shipping_zone', $response, $item, $request );

Where the hook is used in WooCommerce

Usage not found.