Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

update form-shipping.php #5227

Closed
wants to merge 2 commits into from

2 participants

@ChromeOrange
Collaborator

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

ChromeOrange added some commits
@ChromeOrange ChromeOrange Merge pull request #1 from woothemes/master
Update
0ada403
@ChromeOrange ChromeOrange 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
6cb5451
@mikejolley mikejolley closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 28, 2014
  1. @ChromeOrange
  2. @ChromeOrange

    Update form-shipping.php

    ChromeOrange authored
    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 page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 templates/checkout/form-shipping.php
View
4 templates/checkout/form-shipping.php
@@ -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 @@
<?php endif; ?>
<?php do_action( 'woocommerce_after_order_notes', $checkout ); ?>
-</div>
+</div>
Something went wrong with that request. Please try again.