In Magento 2, I would like to be able to select the shipping address with a dropdown, similar to how you can if you choose to change the billing address.
This is how it currently works:
I would like it to work similarly to when you change the billing address, with a dropdown:
I can see the dropdown for the billing address is set in:
app/code/Magento/Checkout/view/frontend/web/template/billing-address/list.html
But I can't find the knockout template for the shipping address section, I thought it would be on of the files in:
app/code/Magento/Checkout/view/frontend/web/template/shipping-information/
or
app/code/Magento/Checkout/view/frontend/web/template/shipping-information/
But I couldn't find any here which worked.
Any ide
Best Answer
The templates for shipping address section are here :
vendor/magento/module-checkout/view/frontend/web/template/shipping-address/list.html
and
vendor/magento/module-checkout/view/frontend/web/template/shipping-address/address-renderer/default.html
You can override the same in your theme like this
app/design/frontend/Vendor/theme/Magento_Checkout/web/template/shipping-address/list.html
As you wish to list the addresses in select dropdown you need to change the code like this:
The js files are located here:
vendor/magento/module-checkout/view/frontend/web/js/view/shipping-address/list.js
and
vendor/magento/module-checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js
You can override the same like this:
app/design/frontend/Vendor/theme/Magento_Checkout/web/js/view/shipping-address/list.js
You can refer to this file
vendor/magento/module-checkout/view/frontend/web/js/view/billing-address.js
for writing functions likeaddressOptions
,addressOptionsText
etc.