Skip to content

Commit d62c612

Browse files
AC-2044::Cart Price Rule with shipping method set as condition is not working Magento-fix unit tests failure
1 parent 2982745 commit d62c612

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/quote.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
define([
99
'ko',
1010
'underscore',
11-
'Magento_Checkout/js/checkout-data',
1211
'domReady!'
13-
], function (ko, _, checkoutData) {
12+
], function (ko, _) {
1413
'use strict';
1514

1615
/**
@@ -149,17 +148,6 @@ define([
149148
*/
150149
isPersistent: function () {
151150
return !!Number(quoteData['is_persistent']);
152-
},
153-
154-
/**
155-
* @return {String|null}
156-
*/
157-
getSelectedMethod: function () {
158-
const selectedShippingMethod = checkoutData.getSelectedShippingRate();
159-
return selectedShippingMethod ? selectedShippingMethod :
160-
this.shippingMethod() ?
161-
this.shippingMethod()['carrier_code'] + '_' + this.shippingMethod()['method_code'] :
162-
null;
163151
}
164152
};
165153
});

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ define([
7373
isNewAddressAdded: ko.observable(false),
7474
saveInAddressBook: 1,
7575
quoteIsVirtual: quote.isVirtual(),
76+
7677
/**
7778
* @return {exports}
7879
*/
@@ -112,6 +113,7 @@ define([
112113

113114
registry.async('checkoutProvider')(function (checkoutProvider) {
114115
var shippingAddressData = checkoutData.getShippingAddressFromData();
116+
115117
if (shippingAddressData) {
116118
checkoutProvider.set(
117119
'shippingAddress',
@@ -257,7 +259,9 @@ define([
257259
rates: shippingService.getShippingRates(),
258260
isLoading: shippingService.isLoading,
259261
isSelected: ko.computed(function () {
260-
return quote.getSelectedMethod();
262+
return quote.shippingMethod() ?
263+
quote.shippingMethod()['carrier_code'] + '_' + quote.shippingMethod()['method_code'] :
264+
null;
261265
}),
262266

263267
/**

0 commit comments

Comments
 (0)