cancel
Showing results for 
Search instead for 
Did you mean: 

Display only a particular address in checkout address dropdown

SOLVED

Display only a particular address in checkout address dropdown

During Check out process, In the dropdown, we are getting All the billing and shipping address, But I need to display only a particular shipping address from the address book in the dropdown, Is it possible.

Screenshot from 2019-05-10 10-25-28.png

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Display only a particular address in checkout address dropdown

Hello @raju_a 

 

vendor/magento/module-checkout/view/frontend/web/js/view/billing-address.js

 

  addressOptions = addressList().filter(function (address) {
            return address.getType() == 'customer-address'; //eslint-disable-line eqeqeq
        });

here you need to add condition 

e.g

 addressOptions = addressList().filter(function (address) {
        if(address.id =2012){
            return address.getType() == 'customer-address'; //eslint-disable-line eqeqeq
}else{
return false;
}
        });

hope you know how to deploy and all thing

if it will help you then mark as solution


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post

4 REPLIES 4

Re: Display only a particular address in checkout address dropdown

Hello @raju_a 

 

i can not able to see your image.

can you please share via some online tool?


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Display only a particular address in checkout address dropdown

Re: Display only a particular address in checkout address dropdown

Hello @raju_a 

 

vendor/magento/module-checkout/view/frontend/web/js/view/billing-address.js

 

  addressOptions = addressList().filter(function (address) {
            return address.getType() == 'customer-address'; //eslint-disable-line eqeqeq
        });

here you need to add condition 

e.g

 addressOptions = addressList().filter(function (address) {
        if(address.id =2012){
            return address.getType() == 'customer-address'; //eslint-disable-line eqeqeq
}else{
return false;
}
        });

hope you know how to deploy and all thing

if it will help you then mark as solution


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Display only a particular address in checkout address dropdown

Thank you very much, I'll try this