Skip to content

Commit 530b97e

Browse files
committed
ACP2E-1143: trigger tax / subtotal estimates refresh on shipping address updates
1 parent 3144a07 commit 530b97e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/cart/estimate-service.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,26 @@ define([
5353
// save rates to cache after load
5454
shippingService.getShippingRates().subscribe(function (rates) {
5555
cartCache.set('rates', rates);
56+
setShippingAddress();
5657
});
5758

5859
// update totals based on updated shipping address / rates changes
59-
if (customerData.get('cart')()['data_id'] &&
60+
if (cartCache.get('shipping-address') && cartCache.get('shipping-address').countryId &&
61+
cartCache.isChanged('shipping-address', quote.shippingAddress()) &&
6062
(!quote.shippingMethod() || !quote.shippingMethod()['method_code'])) {
6163
totalsDefaultProvider.estimateTotals(quote.shippingAddress());
6264
}
6365
}
6466
},
6567

68+
/**
69+
* Cache shipping address until changed
70+
*/
71+
setShippingAddress = function () {
72+
var shippingAddress = _.pick(quote.shippingAddress(), cartCache.requiredFields);
73+
cartCache.set('shipping-address', shippingAddress);
74+
},
75+
6676
/**
6777
* Estimate totals for shipping address.
6878
*/

0 commit comments

Comments
 (0)