diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index 0f36786f10b..c2c586d4072 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -1515,10 +1515,11 @@ class WC_Cart { if ( ! wc_shipping_enabled() || ! is_array( $this->cart_contents ) ) return false; - if ( get_option( 'woocommerce_shipping_cost_requires_address' ) == 'yes' ) { + if ( 'yes' === get_option( 'woocommerce_shipping_cost_requires_address' ) ) { if ( ! WC()->customer->has_calculated_shipping() ) { - if ( ! WC()->customer->get_shipping_country() || ( ! WC()->customer->get_shipping_state() && ! WC()->customer->get_shipping_postcode() ) ) + if ( ! WC()->customer->get_shipping_country() || ( ! WC()->customer->get_shipping_state() && ! WC()->customer->get_shipping_postcode() ) ) { return false; + } } } diff --git a/templates/cart/cart-totals.php b/templates/cart/cart-totals.php index 11a389ef9ae..481f296a439 100644 --- a/templates/cart/cart-totals.php +++ b/templates/cart/cart-totals.php @@ -49,7 +49,7 @@ if ( ! defined( 'ABSPATH' ) ) { - cart->needs_shipping() ) : ?> + cart->needs_shipping() && 'yes' === get_option( 'woocommerce_enable_shipping_calc' ) ) : ?>