How to reload cart item and cart summery data on cart page in Hyva theme or Alpine js ajax response.
How to update cart item and cart summery data on cart page in Hyva theme or Alpine js ajax response?
1 Answer
@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()
})
}