0

I am using trust payments ad I want to hide and disable billing and shipping address from checkout(Place order without billing address). I am able to hide the billing address by following this: https://bsscommerce.com/blog/magento-2-remove-billing-shipping-address-from-checkout/ but not able to place order without it. Any help would be appreciated.

2
  • To place an order pass the billing address same as the shipping address. Sep 2, 2022 at 17:20
  • I want to place an order without shipping and billing addresses
    – mechanic
    Sep 2, 2022 at 17:58

1 Answer 1

0

Ideally you do not want to remove billing address but best workaround would be to hide billing address using CSS and simply set the billing address value to default to the shipping address.

Copy file vendor/magento/module-checkout/view/frontend/web/js/model/checkout-data-resolver.js to app/code/Vendor/Module/view/frontend/web/js/checkout-data-resolver.js

Edit file app/code/Vendor/Module/view/frontend/web/js/checkout-data-resolver.js and comment out code and automatically set billing to match shipping around line 231:

applyBillingAddress: function () {
    var shippingAddress;

    if (quote.billingAddress()) {
        selectBillingAddress(quote.billingAddress());

        return;
    }
    shippingAddress = quote.shippingAddress();

    selectBillingAddress(quote.shippingAddress());

    /*if (shippingAddress &&
        shippingAddress.canUseForBilling() &&
        (shippingAddress.isDefaultShipping() || !quote.isVirtual())
    ) {
        selectBillingAddress(quote.shippingAddress());
    }*/
}

then we can just add a display:none to the billing class of .checkout-billing-address in your custom _payments.less class

If shipping is also needed to be removed then might I suggest reading this article as it might help https://bsscommerce.com/blog/magento-2-remove-billing-shipping-address-from-checkout/

5
  • I tried the link and was able to hide the addresses but place order is still not working.
    – mechanic
    Sep 2, 2022 at 20:17
  • Can you please update your question and provide screenshots of what you want to be done, and what it is currently doing? Unfortunately, I cant help without seeing what is going on.
    – Infinri
    Sep 2, 2022 at 20:20
  • Let's just say I want to place an order without filling in the shipping and billing addresses on checkout.
    – mechanic
    Sep 2, 2022 at 20:35
  • Then your best option is to populate your shipping form with customer data (such as name, address, zip, etc.), set billing info to default to what is in shipping and just hide the forms. Removing these forms will not work mainly because there are a few core files using either shipping or billing details, so YOU DO NEED THEM.
    – Infinri
    Sep 2, 2022 at 20:56
  • Okay. I will try this. Thank you
    – mechanic
    Sep 3, 2022 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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