Help
Frequently asked questions and other useful tidbits.
Cart Class
Updated on April 25th, 2008
Each of these methods returns a cart variable to a callback function. You can also supply different Ajax options for even more control.
- refresh(callback, options)
-
Returns the current cart variable.
Cart.refresh(function(cart) { alert("I've got " + cart.item_count + " items in the cart!"); });
- updateFromForm(formID, callback, options)
-
Submits a specific form ID to add, update, or remove items from the cart.
Cart.updateFromForm('cart_form', function(cart) { alert("Cart updated!"); });
- addItem(optionID, quantity, callback, options)
-
Adds a particular option.id to the cart with the desired quantity (1 by default).
Cart.addItem(1234, 1, function(cart) { alert("Item added!"); });
- updateItem(itemID, quantity, callback, options)
-
Updates a particular item.id in the cart with the desired quantity.
Cart.updateItem(1234, 10, function(cart) { alert("Item updated!"); });
- removeItem(itemID, callback, options)
-
Removes a particular item.id from the cart.
Cart.removeItem(1234, function(cart) { alert("Item removed!"); });
Contact
Can’t find an answer to your question? No worries, we’re here to help.