WordPress at Your Fingertips
function is not described

WC_REST_Shipping_Zone_Locations_V2_Controller::prepare_item_for_response() public WC 1.0

Prepare the Shipping Zone Location for the REST response.

{} It's a method of the class: WC_REST_Shipping_Zone_Locations_V2_Controller{}

No Hooks.


WP_REST_Response. $response


$WC_REST_Shipping_Zone_Locations_V2_Controller = new WC_REST_Shipping_Zone_Locations_V2_Controller();
$WC_REST_Shipping_Zone_Locations_V2_Controller->prepare_item_for_response( $item, $request );
$item(array) (required)
Shipping Zone Location.
$request(WP_REST_Request) (required)
Request object.

Code of WC_REST_Shipping_Zone_Locations_V2_Controller::prepare_item_for_response() WC 5.9.0

public function prepare_item_for_response( $item, $request ) {
	$context = empty( $request['context'] ) ? 'view' : $request['context'];
	$data    = $this->add_additional_fields_to_object( $item, $request );
	$data    = $this->filter_response_by_context( $data, $context );

	// Wrap the data in a response object.
	$response = rest_ensure_response( $data );

	$response->add_links( $this->prepare_links( (int) $request['id'] ) );

	return $response;