Skip to content

Commit 866a154

Browse files
committed
No alert when user "Apply empty Coupon Code" in create new order form (issue 24015)
1 parent 6ccd942 commit 866a154

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

app/code/Magento/Sales/i18n/en_US.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,3 +797,5 @@ Created,Created
797797
Refunds,Refunds
798798
"Allow Zero GrandTotal for Creditmemo","Allow Zero GrandTotal for Creditmemo"
799799
"Allow Zero GrandTotal","Allow Zero GrandTotal"
800+
"Please enter a coupon code!","Please enter a coupon code!"
801+

app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,17 @@ define([
571571
},
572572

573573
applyCoupon : function(code){
574-
this.loadArea(['items', 'shipping_method', 'totals', 'billing_method'], true, {'order[coupon][code]':code, reset_shipping: 0});
575-
this.orderItemChanged = false;
576-
jQuery('html, body').animate({
577-
scrollTop: 0
578-
});
574+
if (!code) {
575+
alert({
576+
content: jQuery.mage.__('Please enter a coupon code!')
577+
});
578+
} else {
579+
this.loadArea(['items', 'shipping_method', 'totals', 'billing_method'], true, {'order[coupon][code]':code, reset_shipping: 0});
580+
this.orderItemChanged = false;
581+
jQuery('html, body').animate({
582+
scrollTop: 0
583+
});
584+
}
579585
},
580586

581587
addProduct : function(id){

0 commit comments

Comments
 (0)