getCart
Returns all items currently in the cart.Response
CartItem[]
getCartItemCount
Returns the total number of items in the cart.addToCart
Adds an item to the cart or increments quantity if it already exists.Parameters
string
required
Product unique identifier
string
required
Variant ID. Use empty string
'' for products without variants.number
default:"1"
Number of items to add
CartAddOptions
Example: Add to Cart Button
updateCartItem
Updates an existing cart item.Parameters
string
required
Product unique identifier
string
required
Variant ID
object
required
removeFromCart
Removes an item from the cart.Parameters
string
required
Product unique identifier
string
required
Variant ID
clearCart
Removes all items from the cart.Cart Backup
The SDK can backup the cart before checkout to restore it if checkout is cancelled.createCartBackup
restoreCartFromBackup
Complete Cart UI Example
Next Steps
Checkout API
Redirect customers to secure hosted checkout
Products API
Fetch products, variants, and categories