WooCommerce reverse behavior of Ship to different address checkbox?

I’d like to reverse the behavior of “Ship to a different address” checkbox on checkout page. When its checked, Shipping form goes hide and Billing form takes the information. I found and changed this line in checkout.js

$( 'div.shipping_address' ).hide();
if ( $( this ).is( ':checked' ) ) {
    $( 'div.shipping_address' ).slideDown();
}

to

Read More
$( 'div.shipping_address' ).slideDown();
if ( $( this ).is( ':checked' ) ) {
    $( 'div.shipping_address' ).hide();
}

it works fine (display as reverse) but when we place order the shipping-form data also updating. How to fix it?

Related posts

1 comment

  1. Below code will prevent updating shipping-form data during place an order

    add_action('woocommerce_checkout_fields', 'woo_optional_fields');
        function woo_optional_fields($wcCheckout_fields) {
            if(//check your shipping condition here){       
                //unset your shipping fields manually here..!!!
                unset($wcCheckout_fields['shipping']['your_all_shipping_fields']);
            }
        }
    

Comments are closed.