Skip to content

Commit 33dec19

Browse files
author
Oleksii Korshenko
authored
MAGETWO-86787: [2.3-develop] Fix missing discount label in checkout #13223
2 parents 59827b7 + b99428b commit 33dec19

File tree

7 files changed

+37
-2
lines changed

7 files changed

+37
-2
lines changed

app/code/Magento/SalesRule/view/frontend/web/js/view/summary/discount.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,25 @@ define([
4444
return this.totals()['coupon_label'];
4545
},
4646

47+
/**
48+
* Get discount title
49+
*
50+
* @returns {null|String}
51+
*/
52+
getTitle: function () {
53+
var discountSegments;
54+
55+
if (!this.totals()) {
56+
return null;
57+
}
58+
59+
discountSegments = this.totals()['total_segments'].filter(function (segment) {
60+
return segment.code === 'discount';
61+
});
62+
63+
return discountSegments.length ? discountSegments[0].title : null;
64+
},
65+
4766
/**
4867
* @return {Number}
4968
*/

app/code/Magento/SalesRule/view/frontend/web/template/cart/totals/discount.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!-- ko if: isDisplayed() -->
88
<tr class="totals">
99
<th colspan="1" style="" class="mark" scope="row">
10-
<span class="title" data-bind="text: title"></span>
10+
<span class="title" data-bind="text: getTitle()"></span>
1111
<span class="discount coupon" data-bind="text: getCouponLabel()"></span>
1212
</th>
1313
<td class="amount" data-bind="attr: {'data-th': title}">

app/code/Magento/SalesRule/view/frontend/web/template/summary/discount.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!-- ko if: isDisplayed() -->
88
<tr class="totals discount">
99
<th class="mark" scope="row">
10-
<span class="title" data-bind="text: title"></span>
10+
<span class="title" data-bind="text: getTitle()"></span>
1111
<span class="discount coupon" data-bind="text: getCouponCode()"></span>
1212
</th>
1313
<td class="amount">

app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_cart.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080
margin-bottom: 0;
8181
overflow: inherit;
8282
}
83+
84+
.discount.coupon {
85+
display: none;
86+
}
8387
}
8488

8589
// Products table

app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_order-summary.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
}
5050
}
5151

52+
.discount.coupon {
53+
display: none;
54+
}
55+
5256
.grand.incl {
5357
& + .grand.excl {
5458
.mark,

app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@
162162
text-align: left;
163163
}
164164
}
165+
166+
.discount.coupon {
167+
display: none;
168+
}
165169
}
166170

167171
// Products table

app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
}
5050
}
5151

52+
.discount.coupon {
53+
display: none;
54+
}
55+
5256
.grand.incl {
5357
& + .grand.excl {
5458
.mark,

0 commit comments

Comments
 (0)