Skip to content

Commit 7acf1bc

Browse files
committed
MC-42813: Feature request: Cart qty update should be reverted back if the requested qty is not available
1 parent 64bd992 commit 7acf1bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/code/Magento/Checkout/view/frontend/web/js/action/update-shopping-cart.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,15 @@ define([
108108
*/
109109
onError: function (response) {
110110
var that = this,
111+
elm,
111112
responseData = JSON.parse(response['error_message']);
112113

113114
if (response['error_message']) {
114115
try {
115116
$.each(responseData, function (index, data) {
116117

117118
if (data.itemId !== undefined) {
118-
var elm = $('#cart-' + data.itemId + '-qty');
119+
elm = $('#cart-' + data.itemId + '-qty');
119120
elm.val(elm.attr('data-item-qty'));
120121
}
121122
response['error_message'] = data.error;

0 commit comments

Comments
 (0)