function addToCartInProductCatalog()

in app/static/utilities.js [41:54]


function addToCartInProductCatalog(button) {
    const id = button.attributes.getNamedItem(`data-product-id`).value;
    button.innerText = `Processing`;
    button.attributes.onclick = ``;
    function updateButton() {
        button.attributes.onclick = `removeFromCartInProductCatalog(this)`;
        button.innerText = `Remove`;
    }
    function restoreButton() {
        button.innerText = `Add to Cart`;
        button.attributes.onclick = `addToCartInProductCatalog(this)`;
    }
    addToCartRequest(id, updateButton, restoreButton);
}