From 2445f71dcf168b673981a4245e1adf0238099758 Mon Sep 17 00:00:00 2001 From: martibelegu Date: Wed, 6 Mar 2024 14:02:46 +0100 Subject: [PATCH] Fix cart quantity increase functionality --- assets/js/theme/cart.js | 13 +++++++------ assets/scss/components/_cart.scss | 3 +++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/assets/js/theme/cart.js b/assets/js/theme/cart.js index 113d5172..274075ef 100644 --- a/assets/js/theme/cart.js +++ b/assets/js/theme/cart.js @@ -266,15 +266,16 @@ export default class Cart extends PageManager { let preVal // cart update - q$('.js-cart-update', this.$cartContent)?.addEventListener('click', (event) => { - const $target = event.currentTarget + q$$('.js-cart-update', this.$cartContent)?.forEach(($btn) => { + $btn.addEventListener('click', (event) => { + const $target = event.currentTarget - event.preventDefault() + event.preventDefault() - // update cart quantity - cartUpdate($target) + // update cart quantity + cartUpdate($target) + }) }) - // cart qty manually updates q$$('.js-cart-item-qty-input', this.$cartContent).forEach(($input) => { $input.addEventListener('focus', function onQtyFocus() { diff --git a/assets/scss/components/_cart.scss b/assets/scss/components/_cart.scss index c70d2fcb..d6ea7b87 100644 --- a/assets/scss/components/_cart.scss +++ b/assets/scss/components/_cart.scss @@ -133,6 +133,9 @@ background: none; outline: none; cursor: pointer; + display: flex; + justify-content: center; + align-items: center; } .c-cart__checkout-button-wrapper {