Skip to content

Instantly share code, notes, and snippets.

@aelaguiz
Created April 7, 2015 16:14
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 aelaguiz/c711f7cbc58dcae34fd4 to your computer and use it in GitHub Desktop.
Save aelaguiz/c711f7cbc58dcae34fd4 to your computer and use it in GitHub Desktop.
Add a product to the cart on Cratejoy via JS
$.ajax({
url: '/cart/add',
type: 'POST',
data: {
product_id: 1579,
term_cycles: 3,
'variant:Color': 'silver'
}, success: function(data) {
console.log('Cart Item ID: ' + data.id);
console.log('Cart size: ' + data.cart_size);
} });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment