Skip to content

Commit 0ffbe25

Browse files
andrewbessAndrii Beziazychnyi
authored and
Andrii Beziazychnyi
committed
#25529: Wrong program code in
"Magento/Checkout/view/frontend/web/js/view/summary/shipping.js" - added additional checking of shippingMethod type - need to be an array - fixed condition to output "shipping method title"
1 parent 970abcb commit 0ffbe25

File tree

1 file changed

+8
-3
lines changed
  • app/code/Magento/Checkout/view/frontend/web/js/view/summary

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55

66
define([
77
'jquery',
8+
'underscore',
89
'Magento_Checkout/js/view/summary/abstract-total',
910
'Magento_Checkout/js/model/quote',
1011
'Magento_SalesRule/js/view/summary/discount'
11-
], function ($, Component, quote, discountView) {
12+
], function ($, _, Component, quote, discountView) {
1213
'use strict';
1314

1415
return Component.extend({
@@ -22,19 +23,23 @@ define([
2223
* @return {*}
2324
*/
2425
getShippingMethodTitle: function () {
25-
var shippingMethod = '',
26+
var shippingMethod,
2627
shippingMethodTitle = '';
2728

2829
if (!this.isCalculated()) {
2930
return '';
3031
}
3132
shippingMethod = quote.shippingMethod();
3233

34+
if (!_.isArray(shippingMethod)) {
35+
return '';
36+
}
37+
3338
if (typeof shippingMethod['method_title'] !== 'undefined') {
3439
shippingMethodTitle = ' - ' + shippingMethod['method_title'];
3540
}
3641

37-
return shippingMethod ?
42+
return shippingMethodTitle ?
3843
shippingMethod['carrier_title'] + shippingMethodTitle :
3944
shippingMethod['carrier_title'];
4045
},

0 commit comments

Comments
 (0)