WC_Cart::check_cart_items()publicWC 1.0

Check all cart items for errors.

Method of the class: WC_Cart{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Cart = new WC_Cart();
$WC_Cart->check_cart_items();

WC_Cart::check_cart_items() code WC 9.4.2

public function check_cart_items() {
	$return = true;
	$result = $this->check_cart_item_validity();

	if ( is_wp_error( $result ) ) {
		wc_add_notice( $result->get_error_message(), 'error' );
		$return = false;
	}

	$result = $this->check_cart_item_stock();

	if ( is_wp_error( $result ) ) {
		wc_add_notice( $result->get_error_message(), 'error' );
		$return = false;
	}

	return $return;
}