[2.5] Hide shipping row when calculator is disabled, and shipping costs are hidden

Fixes #10519
This commit is contained in:
Mike Jolley 2016-03-10 12:26:49 +00:00
parent b4f4e3c7ab
commit 726728071b
2 changed files with 4 additions and 3 deletions

View File

@ -1515,10 +1515,11 @@ class WC_Cart {
if ( ! wc_shipping_enabled() || ! is_array( $this->cart_contents ) ) if ( ! wc_shipping_enabled() || ! is_array( $this->cart_contents ) )
return false; 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->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; return false;
}
} }
} }

View File

@ -49,7 +49,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php do_action( 'woocommerce_cart_totals_after_shipping' ); ?> <?php do_action( 'woocommerce_cart_totals_after_shipping' ); ?>
<?php elseif ( WC()->cart->needs_shipping() ) : ?> <?php elseif ( WC()->cart->needs_shipping() && 'yes' === get_option( 'woocommerce_enable_shipping_calc' ) ) : ?>
<tr class="shipping"> <tr class="shipping">
<th><?php _e( 'Shipping', 'woocommerce' ); ?></th> <th><?php _e( 'Shipping', 'woocommerce' ); ?></th>