Ajax Cart
The Ajax Cart module is a wrapper for the Shopify Ajax API.
getCart, addItem, updateCart, updateItem, clearItems and getShippingRates methods are available using this module. An additional getProduct method is currently available seperately via the Product module.
All methods include an event listener.
getCart
Fetches the current cart as a JSON object.
Event listener
You can also listen for the getCart event throughout your project.
addItem
Adds an item to the cart.
Requires variant id
and quantity
Also accepts properties
as an array of value pairs, ie { key : value }
Event listener
updateCart
Updates line items, cart notes and cart attributes.
Accepts properties
as an array of value pairs, ie { key : value }
Event listener
updateItem
Updates the quantity of a line item.
Requires variant id
or line index, and quantity
Event listener
clearItems
Clears all line items, but not cart atrributes or notes.
Event listener
getShippingRates
Fetch the shipping rates as a JSON object.
Requires an address.
Event listener
Last updated
Was this helpful?