Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ---------------------------------------------------------
- // POST to cart/update.js returns the cart in JSON.
- // To clear a particular attribute, set its value to an empty string.
- // Receives attributes as a hash or array. Look at comments below.
- // ---------------------------------------------------------
- Shopify.updateCartAttributes = function(data, callback) {
- var params = {
- type: 'POST',
- url: '/cart/update.js',
- data: data,
- dataType: 'json',
- success: function(cart) {
- if ((typeof callback) === 'function') {
- callback(cart);
- }
- else {
- Shopify.onCartUpdate(cart);
- }
- },
- error: function(XMLHttpRequest, textStatus) {
- Shopify.onError(XMLHttpRequest, textStatus);
- }
- };
- jQuery.ajax(params);
- };
Add Comment
Please, Sign In to add comment