5

Is there a way to prevent the addition of a different address at checkout, so that billing and shipping addresses are always the same?

With this I'd like to also prevent the user adding a shipping address in their account, and if they already have more than one to hide any but the first. And that updating the billing address also updates the shipping address.

Since I don't believe this is a on/off functionality in the Magento 2 backend I assume this would require and entire module?

3
  • you need to force customer to fill same shipping and billing address, right? Nov 11 '16 at 13:44
  • I'd prefer to remove the shipping information entirely and pass the billing info to the payment gateway as the shipping info.
    – Aravona
    Nov 14 '16 at 8:37
  • you can used magento event obserer functionality to set same shipping address. Nov 14 '16 at 9:23
0

Add This code on your header

 <script type="text/javascript">

        require(['jquery'],function($){


                $(document).ready(function () {
                     $(document).ajaxComplete(function () {
                         if($('input#billing-address-same-as-shipping-shared').prop("checked") == true){
                        }else{
                            $('input#billing-address-same-as-shipping-shared').trigger('click');
                        }
                });
            });

        });

    </script>
    <style type="text/css">
        .field._required[name="shippingAddress.city"],.box.box-address-billing { display: none!important; }
        .checkout-billing-address { display: none; }
        /*.checkout-billing-address { pointer-events: none; display: none; }
        input#billing-address-same-as-shipping-shared { opacity: .5; }*/
    </style>
0

Try this method, without the following line:

<render args="detailsTemplate"/>

Briefly tested, should work for the frontend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.