Automattic\WooCommerce\Admin\API
ProductVariations::prepare_object_for_response()
Prepare a single variation output for response.
Method of the class: ProductVariations{}
No Hooks.
Return
WP_REST_Response
.
Usage
$ProductVariations = new ProductVariations(); $ProductVariations->prepare_object_for_response( $object, $request );
- $object(WC_Data) (required)
- Object data.
- $request(WP_REST_Request) (required)
- Request object.
ProductVariations::prepare_object_for_response() ProductVariations::prepare object for response code WC 9.3.3
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; }