Skip to content

Instantly share code, notes, and snippets.

@Sally165

Sally165/Focal Secret

Created April 24, 2023 01:47
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/c06301c529e1540a7c6315e5ddfd2a37 to your computer and use it in GitHub Desktop.
Save Sally165/c06301c529e1540a7c6315e5ddfd2a37 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>
<!--- 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