Skip to content

Instantly share code, notes, and snippets.

@samnazari
Created May 30, 2017 23:06
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 samnazari/f4638389b671301c51cb7d16335ded21 to your computer and use it in GitHub Desktop.
Save samnazari/f4638389b671301c51cb7d16335ded21 to your computer and use it in GitHub Desktop.
Ascend - Shopify - Shopping Cart Integration
<script type="text/javascript">
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
var ascendCookies = getCookie('_ascend_current');
var ascendInput = document.createElement('input');
ascendInput.type = 'hidden';
ascendInput.name = 'attributes[ascend]';
ascendInput.value = ascendCookies;
document.querySelector('form.cart').appendChild(ascendInput);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment