WC_Cart_Session::cart_has_shippable_products
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() 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;
}