Skip to content

Instantly share code, notes, and snippets.

@Sally165
Created April 24, 2023 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sally165/7a4d44aee4b5e97aa6e9aa8cf8d53ade to your computer and use it in GitHub Desktop.
Save Sally165/7a4d44aee4b5e97aa6e9aa8cf8d53ade to your computer and use it in GitHub Desktop.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
try {
setTimeout(function () {
window.__pagefly_helper_store__ &&
window.__pagefly_helper_store__.subscribe(function (res) {
$.getJSON('/cart.json').then(cart => {
document.documentElement.dispatchEvent(new CustomEvent('product:added', {
bubbles: true,
detail: {
quantity: 1
}
}));
$('.header__cart-count').text(cart.item_count)
});
});
}, 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