WC_REST_Products_V2_Controller::api_get_meta_data()protectedWC 1.0

Fetch meta data.

Method of the class: WC_REST_Products_V2_Controller{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->api_get_meta_data( $product, $context );
$product(WC_Product) (required)
Product object.
$context(string) (required)
Context of request, can be view or edit.

WC_REST_Products_V2_Controller::api_get_meta_data() code WC 8.7.0

protected function api_get_meta_data( $product, $context ) {
	$meta_data = $product->get_meta_data();

	if ( ! isset( $this->request ) || ! $this->request instanceof WP_REST_Request ) {
		return $meta_data;
	}

	return $this->get_meta_data_for_response( $this->request, $meta_data );
}