WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Utilities

CartController::get_cart_coupon_errors() public WC 1.0

Validate all items in the cart and get a list of errors.

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

No Hooks.

Return

null. Nothing.

Usage

$CartController = new CartController();
$CartController->get_cart_coupon_errors();

Code of CartController::get_cart_coupon_errors() WC 5.8.0

public function get_cart_coupon_errors() {
	$errors       = [];
	$cart_coupons = $this->get_cart_coupons();

	foreach ( $cart_coupons as $code ) {
		try {
			$coupon = new \WC_Coupon( $code );
			$this->validate_cart_coupon( $coupon );
		} catch ( RouteException $error ) {
			$errors[] = new \WP_Error( $error->getErrorCode(), $error->getMessage() );
		}
	}

	return $errors;
}