Skip to content

Instantly share code, notes, and snippets.

@carolineschnapp
Created March 2, 2012 21:25
Show Gist options
  • Save carolineschnapp/1961517 to your computer and use it in GitHub Desktop.
Save carolineschnapp/1961517 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>
@carolineschnapp
Copy link
Author

Add this at the very bottom of cart.liquid to auto-save your cart attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment