Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve "Clear Shopping Cart" button not working in Internet Explorer issue24491 #24499

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<span><?= $block->escapeHtml(__('Continue Shopping')) ?></span>
</a>
<?php endif; ?>
<button type="submit"
<button type="button"
name="update_cart_action"
data-cart-empty=""
value="empty_cart"
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ define([
_create: function () {
var items, i, reload;

$(this.options.emptyCartButton).on('click', $.proxy(function (event) {
if (event.detail === 0) {
return;
}

$(this.options.emptyCartButton).on('click', $.proxy(function () {
$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
$(this.options.updateCartActionContainer)
.attr('name', 'update_cart_action').attr('value', 'empty_cart');

if ($(this.options.emptyCartButton).parents('form').length > 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you describe why this fixes the reported bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DrewML: I remove event.detail == 0 because it isn't supported by IE.11.

event.detail code is added to fix the bug #21499.

I removed it and changed to other solution to fix issue 21499. When the cart is updated, it should't call the emptyCartButton. So I change it to "button" element. So the emptyCartButton isn't trigger click when the qty is update.

$(this.options.emptyCartButton).parents('form').submit();
}
}, this));
items = $.find('[data-role="cart-item-qty"]');

Expand Down