WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Routes

CartItems::get_route_response() protected WC 1.0

Get a collection of cart items.

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

No Hooks.

Return

\WP_REST_Response.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_route_response( $request );
$request(WP_REST_Request) (required)
Request object.

Code of CartItems::get_route_response() WC 5.7.1

protected function get_route_response( \WP_REST_Request $request ) {
	$cart_items = $this->cart_controller->get_cart_items();
	$items      = [];

	foreach ( $cart_items as $cart_item ) {
		$data    = $this->prepare_item_for_response( $cart_item, $request );
		$items[] = $this->prepare_response_for_collection( $data );
	}

	$response = rest_ensure_response( $items );

	return $response;
}