WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Routes

AbstractCartRoute::get_response() public WC 1.0

Get the route response based on the type of request.

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

No Hooks.

Return

\WP_Error|\WP_REST_Response.

Usage

$AbstractCartRoute = new AbstractCartRoute();
$AbstractCartRoute->get_response( $request );
$request(WP_REST_Request) (required)
Request object.

Code of AbstractCartRoute::get_response() WC 5.8.0

public function get_response( \WP_REST_Request $request ) {
	$this->cart_controller->load_cart();
	$this->calculate_totals();

	if ( $this->requires_nonce( $request ) ) {
		$nonce_check = $this->check_nonce( $request );

		if ( is_wp_error( $nonce_check ) ) {
			return $this->add_nonce_headers( $this->error_to_response( $nonce_check ) );
		}
	}

	try {
		$response = parent::get_response( $request );
	} catch ( RouteException $error ) {
		$response = $this->get_route_error_response( $error->getErrorCode(), $error->getMessage(), $error->getCode(), $error->getAdditionalData() );
	} catch ( \Exception $error ) {
		$response = $this->get_route_error_response( 'unknown_server_error', $error->getMessage(), 500 );
	}

	if ( is_wp_error( $response ) ) {
		$response = $this->error_to_response( $response );
	}

	return $this->add_nonce_headers( $response );
}