Update form-shipping.php

Add filter to allow needs_shipping() to be overridden, useful if you want to collect a shipping address for virtual products.

Allows a filter to be used as replacement for get_option('woocommerce_require_shipping_address')

Previous suggestion of add_filter('woocommerce_cart_needs_shipping', '__return_true'); is not suitable
This commit is contained in:
Andrew Benbow 2014-03-28 02:27:24 +00:00
parent 0ada403433
commit 6cb5451e15
1 changed files with 2 additions and 2 deletions

View File

@ -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() || apply_filters('woocommerce_override_needs_shipping' , false ) == true ) && ! WC()->cart->ship_to_billing_address_only() ) : ?>
<?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>