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_Error/\WP_REST_Response.

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

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

Код AbstractRoute::get_response() WC 4.7.0

<?php
public function get_response( \WP_REST_Request $request ) {
	$response = null;
	try {
		if ( 'GET' !== $request->get_method() ) {
			$this->check_nonce( $request );
		}
		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;
		}
		if ( 'GET' !== $request->get_method() && ! is_wp_error( $response ) ) {
			$response->header( 'X-WC-Store-API-Nonce', wp_create_nonce( 'wc_store_api' ) );
		}
	} 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 );
	}
	return $response;
}