Skip to content

Commit 9c4ade9

Browse files
Max Mezhenskymahesh-singh-rajawat
authored andcommitted
34866: Save address data from shopping cart page
1 parent aab3ee6 commit 9c4ade9

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ define([
1717
'mage/translate',
1818
'uiRegistry',
1919
'Magento_Checkout/js/model/shipping-address/form-popup-state',
20+
'Magento_Checkout/js/action/set-shipping-information',
2021
'Magento_Checkout/js/model/quote'
2122
], function (
2223
$,
@@ -28,7 +29,9 @@ define([
2829
defaultValidator,
2930
$t,
3031
uiRegistry,
31-
formPopUpState
32+
formPopUpState,
33+
setShippingInformationAction,
34+
quote
3235
) {
3336
'use strict';
3437

@@ -198,6 +201,10 @@ define([
198201
addressFlat = uiRegistry.get('checkoutProvider').shippingAddress;
199202
address = addressConverter.formAddressDataToQuoteAddress(addressFlat);
200203
selectShippingAddress(address);
204+
205+
if (quote.shippingMethod()) {
206+
setShippingInformationAction();
207+
}
201208
}
202209
},
203210

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-save-processor/default.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ define([
3333
* @return {jQuery.Deferred}
3434
*/
3535
saveShippingInformation: function () {
36-
var payload;
36+
var payload,
37+
email;
3738

3839
if (!quote.billingAddress() && quote.shippingAddress().canUseForBilling()) {
3940
selectBillingAddressAction(quote.shippingAddress());
@@ -58,7 +59,12 @@ define([
5859
).done(
5960
function (response) {
6061
quote.setTotals(response.totals);
61-
paymentService.setPaymentMethods(methodConverter(response['payment_methods']));
62+
email = quote.shippingAddress().email;
63+
64+
if (!_.isUndefined(email) && email) {
65+
paymentService.setPaymentMethods(methodConverter(response['payment_methods']));
66+
}
67+
6268
fullScreenLoader.stopLoader();
6369
}
6470
).fail(

app/code/Magento/Checkout/view/frontend/web/js/view/cart/shipping-rates.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ define([
1111
'Magento_Catalog/js/price-utils',
1212
'Magento_Checkout/js/model/quote',
1313
'Magento_Checkout/js/action/select-shipping-method',
14+
'Magento_Checkout/js/action/set-shipping-information',
1415
'Magento_Checkout/js/checkout-data'
15-
], function (ko, _, Component, shippingService, priceUtils, quote, selectShippingMethodAction, checkoutData) {
16+
], function (ko, _, Component, shippingService, priceUtils, quote, selectShippingMethodAction, setShippingInformationAction, checkoutData) {
1617
'use strict';
1718

1819
return Component.extend({
@@ -78,6 +79,10 @@ define([
7879
selectShippingMethodAction(methodData);
7980
checkoutData.setSelectedShippingRate(methodData['carrier_code'] + '_' + methodData['method_code']);
8081

82+
if (quote.shippingMethod()) {
83+
setShippingInformationAction();
84+
}
85+
8186
return true;
8287
}
8388
});

0 commit comments

Comments
 (0)