Merge pull request #5230 from ChromeOrange/master
show shipping form filter
This commit is contained in:
commit
c981bb56ca
|
@ -1355,6 +1355,22 @@ class WC_Cart {
|
|||
return apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping );
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the shipping address form be shown
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function needs_shipping_address() {
|
||||
|
||||
$needs_shipping_address = false;
|
||||
|
||||
if ( WC()->cart->needs_shipping() === true && ! WC()->cart->ship_to_billing_address_only() ) {
|
||||
$needs_shipping_address = true;
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_cart_needs_shipping_address', $needs_shipping_address );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sees if the customer has entered enough data to calc the shipping yet.
|
||||
*
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
?>
|
||||
<div class="woocommerce-shipping-fields">
|
||||
<?php if ( WC()->cart->needs_shipping() && ! WC()->cart->ship_to_billing_address_only() ) : ?>
|
||||
<?php if ( WC()->cart->needs_shipping_address() === true ) : ?>
|
||||
|
||||
<?php
|
||||
if ( empty( $_POST ) ) {
|
||||
|
@ -65,4 +65,4 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_after_order_notes', $checkout ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue