AbstractRoute::get_route_error_response_from_object( WP_Error $error_object, int $http_status_code = 500, array $additional_data = array() )
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.
Description Description
Parameters Parameters
- $error_object
-
(Required) The WP_Error object containing the error.
- $http_status_code
-
(Optional) HTTP status. Defaults to 500.
Default value: 500
- $additional_data
-
(Optional) Extra data (key value pairs) to expose in the error response.
Default value: array()
Return Return
(WP_Error) WP Error object.
Source Source
File: packages/woocommerce-blocks/src/StoreApi/Routes/AbstractRoute.php