-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fix missing discount label in checkout #13141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix missing discount label in checkout #13141
Conversation
return null; | ||
} | ||
|
||
var discountSegments = this.totals()['total_segments'].filter(function (segment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All variables declarations must be at the top of the function scope. Please, try to move the variable declaration to the beginning of the getTitle() function
} | ||
|
||
var discountSegments = this.totals()['total_segments'].filter(function (segment) { | ||
return (segment.code === 'discount'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, the parenthesis is redundant here. This fact is the reason of failing static tests
@rogyar Thank you for the review! 👍 |
Fix js static test
Fix js static test
Is this part of the upcoming 2.2.4 release? |
This fix is part of the release 2.2.4 and now my custom discount is shown but the label discount is not. Is there a way to fix that ? Because it only check the word discount not any thing containing discount. A possible change could be: /**
* Get discount title
*
* @returns {null|String}
*/
getTitle: function () {
var discountSegments;
if (!this.totals()) {
return null;
}
discountSegments = this.totals()['total_segments'].filter(function (segment) {
return segment.code.indexOf('discount') !== -1;
});
return discountSegments.length ? discountSegments[0].title : null;
}, |
@rsantellan feel free to create PR with your changes |
Description
The discount label was not being shown in the shopping cart totals description
Continuing of #11883
Fixed Issues
Manual testing scenarios
Related PRs
#13141
#13223
Contribution checklist