WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Routes

Checkout::get_route_error_response_from_object() protected WC 1.0

Get route response when something went wrong.

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

No Hooks.

Return

\WP_Error. WP Error object.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_route_error_response_from_object( $error_object, $http_status_code, $additional_data );
$error_object(\WP_Error) (required)
User facing error message.
$http_status_code(int)
HTTP status.
Default: 500
$additional_data(array)
Extra data (key value pairs) to expose in the error response.
Default: []

Code of Checkout::get_route_error_response_from_object() WC 5.8.0

protected function get_route_error_response_from_object( $error_object, $http_status_code = 500, $additional_data = [] ) {
	// 409 is when there was a conflict, so we return the cart so the client can resolve it.
	if ( 409 === $http_status_code ) {
		return $this->add_data_to_error_object( $error_object, $additional_data, $http_status_code, true );
	}
	return $this->add_data_to_error_object( $error_object, $additional_data, $http_status_code );
}