WC_Cart_Session::cart_has_shippable_productsprivateWC 1.0

Check if the cart has shippable products.

Method of the class: WC_Cart_Session{}

No Hooks.

Returns

true|false.

Usage

// private - for code of main (parent) class only
$result = $this->cart_has_shippable_products();

WC_Cart_Session::cart_has_shippable_products() code WC 10.5.0

private function cart_has_shippable_products() {
	foreach ( $this->cart->get_cart() as $cart_item ) {
		if ( $cart_item['data']->needs_shipping() ) {
			return true;
		}
	}
	return false;
}