-
-
Save Sally165/ec7499177b190e5b5c6e189d2e6fd217 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
<!-- PAGEFLY CART HELPER - DO NOT DELETE --> | |
<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 => { | |
fetch('/?snippets_id=cart-drawer').then(d=>d.text()).then(text=>{ | |
const sectionInnerHTML = new DOMParser().parseFromString(text, 'text/html'); | |
const cartFormInnerHTML = sectionInnerHTML.getElementById('site-header-drawer-cart').innerHTML; | |
$('#site-header-drawer-cart').html(cartFormInnerHTML) | |
$('[data-header-drawer-toggle="cart"]')[0].click() | |
$('span.site-header-action-icon-cart-count').html(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