Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aaliyan111/8e38d17928e350b4b2839e87f0c99ef5 to your computer and use it in GitHub Desktop.
Save aaliyan111/8e38d17928e350b4b2839e87f0c99ef5 to your computer and use it in GitHub Desktop.
Add this at the bottom of cart.liquid to auto-save your cart attributes
<script type="text/javascript" charset="utf-8">
//<![CDATA[
jQuery(function() {
jQuery(window).unload(function() {
var params = {
type: 'POST',
url: '/cart/update.js',
data: jQuery('form[action="/cart"]').serialize(),
dataType: 'json',
async: false
};
jQuery.ajax(params);
});
});
//]]>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment