WC_Cart_Session::cart_has_shippable_productsprivateWC 1.0

Check if the cart has shippable products.

Метод класса: WC_Cart_Session{}

Хуков нет.

Возвращает

true|false.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->cart_has_shippable_products();

Код WC_Cart_Session::cart_has_shippable_products() WC 11.0.1

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