2

How to reload cart item and cart summery data on cart page in Hyva theme or Alpine js ajax response.

1 Answer 1

2

@ARJUN Try this in your ajax response.

function reloadCartContent() {
    window.fetch(window.location.href, {
        method: "GET"
    }).then((result) => {
        return result.text()

    }).then((body) => {
        hyva.setCookie('mage-cache-sessid', '', -1, true);
        window.checkoutConfig = null;
        hyva.replaceDomElement('#maincontent', body)

    }).catch((error) => {
        console.error(error);
        window.location.reload()
    })
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.