Skip to content

Commit b370b1e

Browse files
authored
#22478: Move reload logic to the appropriate place
1 parent ce6c228 commit b370b1e

File tree

1 file changed

+4
-5
lines changed
  • app/code/Magento/Checkout/view/frontend/web/js

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ define([
261261
$(document).trigger('ajax:removeFromCart', {
262262
productIds: [productData['product_id']]
263263
});
264+
if (window.location.href === this.shoppingCartUrl) {
265+
location.reload();
266+
}
264267
}
265268
},
266269

@@ -306,14 +309,10 @@ define([
306309
}
307310
})
308311
.done(function (response) {
309-
var msg, currentURL;
312+
var msg;
310313

311314
if (response.success) {
312315
callback.call(this, elem, response);
313-
currentURL = window.location.pathname;
314-
if (currentURL.includes("/checkout/cart/")) {
315-
location.reload();
316-
}
317316
} else {
318317
msg = response['error_message'];
319318

0 commit comments

Comments
 (0)