Skip to content

Commit

Permalink
Fix cart quantity increase functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
mgbelegu committed Mar 6, 2024
1 parent e3d4be7 commit 2445f71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 7 additions & 6 deletions assets/js/theme/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 3 additions & 0 deletions assets/scss/components/_cart.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@
background: none;
outline: none;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
}

.c-cart__checkout-button-wrapper {
Expand Down

0 comments on commit 2445f71

Please sign in to comment.