From 6cb5451e15fec6c79dea4a54c73fa0b3180c4247 Mon Sep 17 00:00:00 2001 From: Andrew Benbow Date: Fri, 28 Mar 2014 02:27:24 +0000 Subject: [PATCH] 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 --- templates/checkout/form-shipping.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/checkout/form-shipping.php b/templates/checkout/form-shipping.php index e37b28d4eb0..93e22bd5aee 100644 --- a/templates/checkout/form-shipping.php +++ b/templates/checkout/form-shipping.php @@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
- cart->needs_shipping() && ! WC()->cart->ship_to_billing_address_only() ) : ?> + cart->needs_shipping() || apply_filters('woocommerce_override_needs_shipping' , false ) == true ) && ! WC()->cart->ship_to_billing_address_only() ) : ?> -
\ No newline at end of file +