-
-
Save Sally165/c06301c529e1540a7c6315e5ddfd2a37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<!--- PageFly Cart Helper code - DO NOT DELETE --> | |
<script> | |
try { | |
setTimeout(function () { | |
window.__pagefly_helper_store__ && | |
window.__pagefly_helper_store__.subscribe(function (res) { | |
$.getJSON('/cart.json').then(cart => { | |
fetch(`${window.themeVariables.routes.cartUrl}.js`).then(async (response2) => { | |
const cartContent = await response2.json(); | |
document.documentElement.dispatchEvent(new CustomEvent("cart:updated", { | |
bubbles: true, | |
detail: { | |
cart: cartContent | |
} | |
})); | |
document.documentElement.dispatchEvent(new CustomEvent("cart:refresh", { | |
bubbles: true, | |
detail: { | |
cart: cartContent, | |
openMiniCart: window.themeVariables.settings.cartType === "drawer" | |
} | |
})); | |
}); | |
}); | |
}); | |
}, 2500); | |
} catch (e) { | |
console.warn(e); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment