-
-
Save Sally165/851202cc615adacf5bc8deee740ffe81 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
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