Skip to content

Commit 3218e55

Browse files
MAGETWO-64544: When logged in customer edits a new shipping address during checkout they are unable to place the order #6488
1 parent 1ec390d commit 3218e55

File tree

1 file changed

+15
-6
lines changed
  • app/code/Magento/Checkout/view/frontend/web/js/view

1 file changed

+15
-6
lines changed

app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,7 @@ define([
153153
class: buttons.cancel.class ? buttons.cancel.class : 'action secondary action-hide-popup',
154154

155155
/** @inheritdoc */
156-
click: function () {
157-
// Revert address.
158-
checkoutData.setShippingAddressFromData(self.tempData);
159-
this.closeModal();
160-
}
156+
click: this.onClosePopUp.bind(this)
161157
}
162158
];
163159

@@ -166,6 +162,11 @@ define([
166162
self.isFormPopUpVisible(false);
167163
};
168164

165+
this.popUpForm.options.modalCloseBtnHandler = this.onClosePopUp.bind(this);
166+
this.popUpForm.options.keyEventHandlers = {
167+
escapeKey: this.onClosePopUp.bind(this)
168+
};
169+
169170
/** @inheritdoc */
170171
this.popUpForm.options.opened = function () {
171172
// Store temporary address for revert action in case when user click cancel action
@@ -177,6 +178,14 @@ define([
177178
return popUp;
178179
},
179180

181+
/**
182+
* Revert address and close modal.
183+
*/
184+
onClosePopUp: function () {
185+
checkoutData.setShippingAddressFromData($.extend(true, {}, this.temporaryAddress));
186+
this.getPopUp().closeModal();
187+
},
188+
180189
/**
181190
* Show address form popup
182191
*/
@@ -203,7 +212,7 @@ define([
203212
newShippingAddress = createShippingAddress(addressData);
204213
selectShippingAddress(newShippingAddress);
205214
checkoutData.setSelectedShippingAddress(newShippingAddress.getKey());
206-
checkoutData.setNewCustomerShippingAddress(addressData);
215+
checkoutData.setNewCustomerShippingAddress($.extend(true, {}, addressData));
207216
this.getPopUp().closeModal();
208217
this.isNewAddressAdded(true);
209218
}

0 commit comments

Comments
 (0)