Skip to content
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("click", function(e) {
if (e.target.closest(".gempages-add-to-cart-button")) {
fetch('/cart.js')
.then(response => response.json())
.then(data => {
// Update the cart drawer
if (typeof Shopify.theme.jsCart !== "undefined") {
Shopify.theme.jsCart.update(data);
} else {
location.reload(); // Fallback if no AJAX update
}
})
.catch(error => console.error("Cart update failed:", error));
}
});
});