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

WC_REST_Products_V1_Controller::prepare_item_for_response() public WC 1.0

Prepare a single product output for response.

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

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

WP_REST_Response.

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

$WC_REST_Products_V1_Controller = new WC_REST_Products_V1_Controller();
$WC_REST_Products_V1_Controller->prepare_item_for_response( $post, $request );
$post(WP_Post) (обязательный)
Post object.
$request(WP_REST_Request) (обязательный)
Request object.

Код WC_REST_Products_V1_Controller::prepare_item_for_response() WC 4.5.2

woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php
<?php
public function prepare_item_for_response( $post, $request ) {
	$product = wc_get_product( $post );
	$data    = $this->get_product_data( $product );

	// Add variations to variable products.
	if ( $product->is_type( 'variable' ) && $product->has_child() ) {
		$data['variations'] = $this->get_variation_data( $product );
	}

	// Add grouped products data.
	if ( $product->is_type( 'grouped' ) && $product->has_child() ) {
		$data['grouped_products'] = $product->get_children();
	}

	$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( $product, $request ) );

	/**
	 * Filter the data for a response.
	 *
	 * The dynamic portion of the hook name, $this->post_type, refers to post_type of the post being
	 * prepared for the response.
	 *
	 * @param WP_REST_Response   $response   The response object.
	 * @param WP_Post            $post       Post object.
	 * @param WP_REST_Request    $request    Request object.
	 */
	return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $post, $request );
}