WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Automattic\WooCommerce\Blocks\StoreApi\Routes

AbstractRoute::get_response() public WC 1.0

Get the route response based on the type of request.

{} Это метод класса: AbstractRoute{}

Хуков нет.

Возвращает

\WP_REST_Response.

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

$AbstractRoute = new AbstractRoute();
$AbstractRoute->get_response( $request );
$request(WP_REST_Request) (обязательный)
Request object.

Код AbstractRoute::get_response() WC 5.7.1

public function get_response( \WP_REST_Request $request ) {
	$response = null;
	try {
		switch ( $request->get_method() ) {
			case 'POST':
				$response = $this->get_route_post_response( $request );
				break;
			case 'PUT':
			case 'PATCH':
				$response = $this->get_route_update_response( $request );
				break;
			case 'DELETE':
				$response = $this->get_route_delete_response( $request );
				break;
			default:
				$response = $this->get_route_response( $request );
				break;
		}
	} catch ( RouteException $error ) {
		$response = $this->get_route_error_response( $error->getErrorCode(), $error->getMessage(), $error->getCode(), $error->getAdditionalData() );
	} catch ( InvalidStockLevelsInCartException $error ) {
		$response = $this->get_route_error_response_from_object( $error->getError(), $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 $response;
}