WordPress at a glance
function is not described

WC_REST_Products_Controller::get_product_data() protected WC 1.0

Get product data.

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

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_product_data( $product, $context );
$product(WC_Product) (required)
Product instance.
$context(string)
Request context. Options: 'view' and 'edit'.

Code of WC_REST_Products_Controller::get_product_data() WC 5.0.0

<?php
protected function get_product_data( $product, $context = 'view' ) {
	$data = parent::get_product_data( ...func_get_args() );
	// Add stock_status if needed.
	if ( isset( $this->request ) ) {
		$fields = $this->get_fields_for_response( $this->request );
		if ( in_array( 'stock_status', $fields ) ) {
			$data['stock_status'] = $product->get_stock_status( $context );
		}
	}
	return $data;
}