WC_REST_Products_V2_Controller::api_get_related_ids()protectedWC 1.0

Fetch related IDs.

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_related_ids( $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_related_ids() code WC 8.9.0

protected function api_get_related_ids( $product, $context ) {
	return array_map( 'absint', array_values( wc_get_related_products( $product->get_id() ) ) );
}