Skip to content

Instantly share code, notes, and snippets.

@Sally165
Created April 21, 2023 09:59
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/851202cc615adacf5bc8deee740ffe81 to your computer and use it in GitHub Desktop.
Save Sally165/851202cc615adacf5bc8deee740ffe81 to your computer and use it in GitHub Desktop.
Version: Venue version 4.6.2
<!-- PAGEFLY CART HELPER - DO NOT DELETE -->
<script>
try {
setTimeout(function () {
window.__pagefly_helper_store__ &&
window.__pagefly_helper_store__.subscribe(function (res) {
$.getJSON('/cart.json').then(cart => {
ajaxCart.load()
$('a.secondary-nav__link.js-cart-trigger').click()
});
});
}, 2500);
} catch (e) {
console.warn(e);
}
</script>
Version:7.0
<script>
window.addEventListener('load', function() {
var { __pagefly_helper_store__ } = window;
__pagefly_helper_store__.subscribe(function(res) {
console.log('res',res)
ShopifyAPI.getCart();
$(document.body).trigger("afterAddItem.ajaxCart");
$('.ajaxcart__product-image img').attr('src',res.image)
$('.ajaxcart__product-name').text(res.title)
$('.ajaxcart__product-meta').each((i,m)=>{
switch(i){
case(1):
$(m).text( Shopify.formatMoney(res.price, theme.money_format) )
break;
default:
if(res.selected_or_first_available_variant){
$(m).text(res.res.selected_or_first_available_variant.title)
}else{
$(m).text(' ')
}
}
})
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment