kollapsminoriteten/wp-content/themes/blocksy/static/js/frontend/woocommerce/additional-inputs-autoupdat...

20 lines
351 B
JavaScript
Raw Normal View History

2026-03-31 11:30:59 +02:00
let timeoutId = null
export const mount = (el, { event }) => {
if (!el.closest('.ct-cart-auto-update')) {
return
}
if (timeoutId) {
clearTimeout(timeoutId)
}
timeoutId = setTimeout(function () {
const updateCartButton = document.querySelector("[name='update_cart']")
if (updateCartButton) {
updateCartButton.click()
}
}, 300)
}