Skip to content

Instantly share code, notes, and snippets.

@ladislavsulc
Created October 26, 2024 12:15
Show Gist options
  • Save ladislavsulc/bd8b2ade873e27f50be8284570cb4e57 to your computer and use it in GitHub Desktop.
Save ladislavsulc/bd8b2ade873e27f50be8284570cb4e57 to your computer and use it in GitHub Desktop.
Assortion Shopify app - custom add to cart (add-ons) settings
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