Skip to content

Commit 2bff63f

Browse files
author
Joan He
committed
MAGETWO-90663: Error/Exception is thrown when user tries to delete product from /checkout/cart page after already been removed from mini-shopping cart
1 parent 4cf1a32 commit 2bff63f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define([
1212
$.widget('mage.shoppingCart', {
1313
/** @inheritdoc */
1414
_create: function () {
15-
var items, i;
15+
var items, i, reload;
1616

1717
$(this.options.emptyCartButton).on('click', $.proxy(function () {
1818
$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
@@ -36,6 +36,27 @@ define([
3636
$(this.options.continueShoppingButton).on('click', $.proxy(function () {
3737
location.href = this.options.continueShoppingUrl;
3838
}, this));
39+
40+
$(document).on('ajax:removeFromCart', $.proxy(function () {
41+
reload = true;
42+
$('div.block.block-minicart').on('dropdowndialogclose', $.proxy(function () {
43+
if (reload === true) {
44+
location.reload();
45+
reload = false;
46+
}
47+
$('div.block.block-minicart').off('dropdowndialogclose');
48+
}));
49+
}, this));
50+
$(document).on('ajax:updateItemQty', $.proxy(function () {
51+
reload = true;
52+
$('div.block.block-minicart').on('dropdowndialogclose', $.proxy(function () {
53+
if (reload === true) {
54+
location.reload();
55+
reload = false;
56+
}
57+
$('div.block.block-minicart').off('dropdowndialogclose');
58+
}));
59+
}, this));
3960
}
4061
});
4162

app/code/Magento/Checkout/view/frontend/web/js/sidebar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ define([
213213
*/
214214
_updateItemQtyAfter: function (elem) {
215215
this._hideItemButton(elem);
216+
$(document).trigger('ajax:updateItemQty');
216217
},
217218

218219
/**

0 commit comments

Comments
 (0)