diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index f8f4f68a09e561e5bb69ed975b123cf6fbd920f8..d83bb9ed58e1723447516b40fbce3ff087ecf82a 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -60,6 +60,8 @@ define( addressOptions: addressOptions, + customerHasAddresses: addressOptions.length > 1, + addressOptionsText: function(address) { return address.getAddressInline(); }, @@ -82,6 +84,10 @@ define( this.source.trigger(this.dataScopePrefix + '.data.validate'); if (!this.source.get('params.invalid')) { var addressData = this.source.get(this.dataScopePrefix); + + if (this.isCustomerLoggedIn && !this.customerHasAddresses) { + this.saveInAddressBook = true; + } addressData.save_in_address_book = this.saveInAddressBook; // New address must be selected as a billing address diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html index ec88cbef634ca37aac501361d7179466908b8044..4174aa194d635afdd5220f2076a8ac71e985a0a7 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html @@ -13,7 +13,7 @@ <!-- ko foreach: getRegion('additional-fieldsets') --> <!-- ko template: getTemplate() --><!-- /ko --> <!--/ko--> - <!-- ko if: (isCustomerLoggedIn) --> + <!-- ko if: (isCustomerLoggedIn && customerHasAddresses) --> <div class="choice field"> <input type="checkbox" class="checkbox" id="billing-save-in-address-book" data-bind="checked: saveInAddressBook" /> <label class="label" for="billing-save-in-address-book">