WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API

ProductVariations::prepare_object_for_response() public WC 1.0

Prepare a single variation output for response.

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

No Hooks.

Return

WP_REST_Response. Nothing.

Usage

$ProductVariations = new ProductVariations();
$ProductVariations->prepare_object_for_response( $object, $request );
$object(WC_Data) (required)
Object data.
$request(WP_REST_Request) (required)
Request object.

Code of ProductVariations::prepare_object_for_response() WC 5.3.0

<?php
public function prepare_object_for_response( $object, $request ) {
	$context  = empty( $request['context'] ) ? 'view' : $request['context'];
	$response = parent::prepare_object_for_response( $object, $request );
	$data     = $response->get_data();

	$data['name']      = $object->get_name( $context );
	$data['type']      = $object->get_type();
	$data['parent_id'] = $object->get_parent_id( $context );

	$response->set_data( $data );

	return $response;
}