WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WC_REST_Shipping_Methods_V2_Controller::prepare_item_for_response() public WC 1.0

Prepare a shipping method for response.

{} Это метод класса: WC_REST_Shipping_Methods_V2_Controller{}

Хуки из метода
Возвращает

WP_REST_Response. $response Response data.

Использование

$WC_REST_Shipping_Methods_V2_Controller = new WC_REST_Shipping_Methods_V2_Controller();
$WC_REST_Shipping_Methods_V2_Controller->prepare_item_for_response( $method, $request );
$method(WC_Shipping_Method) (обязательный)
Shipping method object.
$request(WP_REST_Request) (обязательный)
Request object.

Код WC_REST_Shipping_Methods_V2_Controller::prepare_item_for_response() WC 4.7.1

<?php
public function prepare_item_for_response( $method, $request ) {
	$data = array(
		'id'          => $method->id,
		'title'       => $method->method_title,
		'description' => $method->method_description,
	);

	$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
	$data    = $this->add_additional_fields_to_object( $data, $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( $method, $request ) );

	/**
	 * Filter shipping methods object returned from the REST API.
	 *
	 * @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 apply_filters( 'woocommerce_rest_prepare_shipping_method', $response, $method, $request );
}