Created
October 26, 2024 12:15
-
-
Save ladislavsulc/bd8b2ade873e27f50be8284570cb4e57 to your computer and use it in GitHub Desktop.
Assortion Shopify app - custom add to cart (add-ons) settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handleAddToCartClick() { | |
const button = document.querySelector('[name="add"]'); | |
if (button) { | |
button.addEventListener('click', function () { | |
setTimeout(function () { | |
window.Assortion.updateCart(); | |
}, 1000); | |
}) | |
} | |
} | |
function handleQuantityChange() { | |
document.querySelectorAll(".plus-qty,.minus-qty ").forEach(function (e) { | |
e.addEventListener("click", () => { | |
setTimeout(function () { | |
window.Assortion.updateCart(); | |
}, 500); | |
setTimeout(function () { | |
handleQuantityChange(); | |
}, 1600); | |
}); | |
}); | |
} | |
handleQuantityChange(); | |
handleAddToCartClick(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment