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

Automattic\WooCommerce\Blocks\StoreApi\Routes

AbstractRoute::get_route_error_response_from_object() protected WC 1.0

Get route response when something went wrong and the supplied error is a WP_Error. This currently only happens when an item in the cart is out of stock, partially out of stock, can only be bought individually, or when the item is not purchasable.

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

Хуков нет.

Возвращает

WP_Error. WP Error object.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_route_error_response_from_object( $error_object, $http_status_code, $additional_data );
$error_object(WP_Error) (обязательный)
The WP_Error object containing the error.
$http_status_code(int)
HTTP status.
По умолчанию: 500
$additional_data(массив)
Extra data (key value pairs) to expose in the error response.

Код AbstractRoute::get_route_error_response_from_object() WC 5.4.1

<?php
protected function get_route_error_response_from_object( $error_object, $http_status_code = 500, $additional_data = [] ) {
	$error_object->add_data( array_merge( $additional_data, [ 'status' => $http_status_code ] ) );
	return $error_object;
}