WC_REST_Customer_Downloads_V1_Controller::get_items()publicWC 1.0

Get all customer downloads.

Метод класса: WC_REST_Customer_Downloads_V1_Controller{}

Хуков нет.

Возвращает

Массив.

Использование

$WC_REST_Customer_Downloads_V1_Controller = new WC_REST_Customer_Downloads_V1_Controller();
$WC_REST_Customer_Downloads_V1_Controller->get_items( $request );
$request(WP_REST_Request) (обязательный)
-

Код WC_REST_Customer_Downloads_V1_Controller::get_items() WC 8.7.0

public function get_items( $request ) {
	$downloads = wc_get_customer_available_downloads( (int) $request['customer_id'] );

	$data = array();
	foreach ( $downloads as $download_data ) {
		$download = $this->prepare_item_for_response( (object) $download_data, $request );
		$download = $this->prepare_response_for_collection( $download );
		$data[]   = $download;
	}

	return rest_ensure_response( $data );
}