Skip to content

Commit 976182b

Browse files
committed
Fix missing discount label in checkout
1 parent 5bd0104 commit 976182b

File tree

7 files changed

+35
-2
lines changed

7 files changed

+35
-2
lines changed

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

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

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

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
@@ -166,6 +166,10 @@
166166
text-align: left;
167167
}
168168
}
169+
170+
.discount.coupon {
171+
display: none;
172+
}
169173
}
170174

171175
// 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)