This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,30 @@
define([
'jquery',
'mage/url',
'mage/cookies'
], function ($, urlBuilder) {
'use strict';
function save(code, remove) {
return $.ajax({
url: urlBuilder.build('esun_cart/coupon/save/'),
type: 'post',
dataType: 'json',
data: {
coupon_code: code || '',
remove: remove ? 1 : 0,
form_key: $.mage.cookies.get('form_key')
}
});
}
return {
apply: function (code) {
return save(code, false);
},
remove: function () {
return save('', true);
}
};
});