From 726728071b2ec89c967efe37e65ccb847edcbff7 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 10 Mar 2016 12:26:49 +0000 Subject: [PATCH] [2.5] Hide shipping row when calculator is disabled, and shipping costs are hidden Fixes #10519 --- includes/class-wc-cart.php | 5 +++-- templates/cart/cart-totals.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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' ) ) : ?>