diff --git a/vendor/magento/module-checkout/view/frontend/web/js/model/quote.js b/vendor/magento/module-checkout/view/frontend/web/js/model/quote.js index 3486a9273661..8c11c3ef719a 100644 --- a/vendor/magento/module-checkout/view/frontend/web/js/model/quote.js +++ b/vendor/magento/module-checkout/view/frontend/web/js/model/quote.js @@ -141,6 +141,13 @@ define([ }); return total; + }, + + /** + * @return {Boolean} + */ + isPersistent: function () { + return !!Number(quoteData['is_persistent']); } }; }); diff --git a/vendor/magento/module-checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js b/vendor/magento/module-checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js index 9b2cbcb7a873..0666ac0244e0 100644 --- a/vendor/magento/module-checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js +++ b/vendor/magento/module-checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js @@ -52,8 +52,10 @@ define([ shippingService.setShippingRates(cache); shippingService.isLoading(false); } else { + let async = quote.isPersistent() ? false : true; + storage.post( - serviceUrl, payload, false + serviceUrl, payload, false, 'application/json', {}, async ).done(function (result) { rateRegistry.set(address.getCacheKey(), result); shippingService.setShippingRates(result); diff --git a/lib/web/mage/storage.js b/lib/web/mage/storage.js index ba7cb6a8795c..e71d68bbff25 100644 --- a/lib/web/mage/storage.js +++ b/lib/web/mage/storage.js @@ -36,12 +36,14 @@ define(['jquery', 'mage/url'], function ($, urlBuilder) { * @param {Boolean} global * @param {String} contentType * @param {Object} headers + * @param {Boolean} async * @returns {Deferred} */ - post: function (url, data, global, contentType, headers) { + post: function (url, data, global, contentType, headers, async) { headers = headers || {}; global = global === undefined ? true : global; contentType = contentType || 'application/json'; + async = async === undefined ? true : async; return $.ajax({ url: urlBuilder.build(url), @@ -49,7 +51,8 @@ define(['jquery', 'mage/url'], function ($, urlBuilder) { data: data, global: global, contentType: contentType, - headers: headers + headers: headers, + async: async }); },