You appear to be a bot. Output may be restricted
Description
Validate all items in the cart and get a list of errors.
Usage
$WP_Error[] = CartController::get_cart_item_errors();
Parameters
Returns
WP_Error[] An array of WP_Errors describing the cart's error state.
Source
File name: woocommerce/packages/woocommerce-blocks/src/StoreApi/Utilities/CartController.php
Lines:
1 to 32 of 32
public function get_cart_item_errors() { $errors = []; $cart_items = $this->get_cart_items(); $too_many_in_cart_exceptions = []; $not_purchasable_exceptions = []; $partial_out_of_stock_exceptions = []; $out_of_stock_exceptions = []; foreach ( $cart_items as $cart_item_key => $cart_item ) { try { $this->validate_cart_item( $cart_item ); } catch ( RouteException $error ) { $errors[] = new WP_Error( $error->getErrorCode(), $error->getMessage() ); } catch ( TooManyInCartException $error ) { $too_many_in_cart_exceptions[] = $error; } catch ( NotPurchasableException $error ) { $not_purchasable_exceptions[] = $error; } catch ( PartialOutOfStockException $error ) { $partial_out_of_stock_exceptions[] = $error; } catch ( OutOfStockException $error ) { $out_of_stock_exceptions[] = $error; } } if ( count( $errors ) > 0 ) { return $errors; } return $this->stock_exceptions_to_wp_errors( $too_many_in_cart_exceptions, $not_purchasable_exceptions, $partial_out_of_stock_exceptions, $out_of_stock_exceptions ); }