0

Magento 2 I want to Checkout Page billing address dropdown remove show direct billing address form.

This dropdown i want to remove enter image description here

And show direct billing address form.This type enter image description here

THANKS.

1

Try with below code to remove address-list dropdown and show billing-address form direct.

Create requirejs-config.js file on below path to add mixin for billing-address.js in your custom module.

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
config: {
    mixins: {
        'Magento_Checkout/js/view/billing-address': {
            'Vendor_Module/js/view/billing-address-mixin': true
        }
    }
}

};

Add mixin file billing-address-mixin.js on below path

app/code/Vendor/Module/view/frontend/web/js/view/billing-address-mixin.js

define([
  'jquery',
  'Magento_Customer/js/model/address-list',
  'Magento_Checkout/js/model/quote',
  'Magento_Checkout/js/action/select-billing-address',
  'Magento_Checkout/js/checkout-data',
  'Magento_Customer/js/customer-data'
],
function (
  $,
  addressList,
  quote,
  selectBillingAddress,
  checkoutData,
  customerData
) {
  'use strict';
  var lastSelectedBillingAddress = null,
    countryData = customerData.get('directory-data'),
    addressOptions = addressList().filter(function (address) {
      return address.getType() === 'customer-address';
    });

  return function (Component) {
    return Component.extend({

      /**
       * @return {Boolean}
       */
      useShippingAddress: function () {
        if (this.isAddressSameAsShipping()) {
          selectBillingAddress(quote.shippingAddress());

          this.updateAddresses();
          this.isAddressDetailsVisible(true);
        } else {
          lastSelectedBillingAddress = quote.billingAddress();
          quote.billingAddress(null);
          this.isAddressDetailsVisible(false);
          $('.field.field-select-billing').hide();
          this.isAddressFormVisible(true);
        }
        checkoutData.setSelectedBillingAddress(null);

        return true;
      }
    });
  };
});

I hope this will help you. Thanks!

14
  • i have try your code not working. Please help me Apr 3 at 11:57
  • @MohitPatel there might some conflicts with your custom theme or module, did you checked this on fresh magento? Apr 5 at 4:33
  • Also, i have try fresh Magento but not success. Apr 5 at 5:18
  • Strange! Can you please let me know on checkout page billing-address-mixin.js is loading or not? Apr 5 at 5:21
  • Above code possible add billing-address.js file and how? Please help me Apr 5 at 5:50

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.