WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Routes

Batch::get_response() public WC 1.0

Get the route response.

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

No Hooks.

Return

WP_REST_Response.

Usage

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

Notes

Code of Batch::get_response() WC 5.5.2

<?php
public function get_response( WP_REST_Request $request ) {
	try {
		foreach ( $request['requests'] as $args ) {
			if ( ! stristr( $args['path'], 'wc/store' ) ) {
				throw new RouteException( 'woocommerce_rest_invalid_path', __( 'Invalid path provided.', 'woocommerce' ), 400 );
			}
		}
		$response = rest_get_server()->serve_batch_request_v1( $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 );
	}

	$response->header( 'X-WC-Store-API-Nonce', wp_create_nonce( 'wc_store_api' ) );
	$response->header( 'X-WC-Store-API-Nonce-Timestamp', time() );
	$response->header( 'X-WC-Store-API-User', get_current_user_id() );

	return $response;
}