[2.5] Hide shipping row when calculator is disabled, and shipping costs are hidden
Fixes #10519
This commit is contained in:
parent
b4f4e3c7ab
commit
726728071b
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue