WC_Cart::needs_shipping()
Looks through the cart to see if shipping is actually required.
Description Description
Return Return
(bool) whether or not the cart needs shipping
Source Source
File: includes/class-wc-cart.php
public function needs_shipping() { if ( ! wc_shipping_enabled() || 0 === wc_get_shipping_method_count( true ) ) { return false; } $needs_shipping = false; foreach ( $this->get_cart_contents() as $cart_item_key => $values ) { if ( $values['data']->needs_shipping() ) { $needs_shipping = true; break; } } return apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ); }