Skip to content

I want to change the default success message of applied coupan by taking a private value in JS object

This success message “Your coupon was successfully applied.” should be replaced with coupan label.

I have console.log(totals) value in

vendor/magento/module-sales-rule/view/frontend/web/js/action/set-coupon-code.js

here is portion of my code.

).done(function (response) {
            var deferred;

            if (response) {
                deferred = $.Deferred();
                console.log(totals.totals._lastValue);
                console.log(totals);

and it consist of this hierarchy

enter image description here

I want to get the value of coupon_label, how can i git it?

console.log(totals.totals._lastValue); ??

console.log(totals.totals.getLastValue()); ??
enter image description here