Guest User

Untitled

a guest
May 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. // ---------------------------------------------------------
  2. // POST to cart/update.js returns the cart in JSON.
  3. // To clear a particular attribute, set its value to an empty string.
  4. // Receives attributes as a hash or array. Look at comments below.
  5. // ---------------------------------------------------------
  6. Shopify.updateCartAttributes = function(data, callback) {
  7. var params = {
  8. type: 'POST',
  9. url: '/cart/update.js',
  10. data: data,
  11. dataType: 'json',
  12. success: function(cart) {
  13. if ((typeof callback) === 'function') {
  14. callback(cart);
  15. }
  16. else {
  17. Shopify.onCartUpdate(cart);
  18. }
  19. },
  20. error: function(XMLHttpRequest, textStatus) {
  21. Shopify.onError(XMLHttpRequest, textStatus);
  22. }
  23. };
  24. jQuery.ajax(params);
  25. };
Add Comment
Please, Sign In to add comment