Automattic\WooCommerce\StoreApi\Routes\V1

ShopperLists::get_route_response │ protected │ WC 1.0

Return the lists for the current user.

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

Хуков нет.

Возвращает

\WP_REST_Response.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_route_response( $request );
$request(WP_REST_Request) (обязательный)
Request object.

Код ShopperLists::get_route_response() WC 11.2.2

protected function get_route_response( \WP_REST_Request $request ) {
	$response = array();

	foreach ( ShopperList::get_all_for_user() as $list ) {
		$response[] = $this->prepare_response_for_collection( $this->prepare_item_for_response( $list, $request ) );
	}

	return rest_ensure_response( $response );
}