Skip to main content

IkasCartStore

Refer to the IkasCart reference.

isLoadingCartboolean
isCartLoadFinishedboolean
checkoutIdboolean
checkoutUrlboolean
addItemfunction
Adds a new item to the cart. If the cart is empty, a new cart will be created.
async addItem( variant: IkasProductVariant, product: IkasProduct, initialQuantity = 1 )
variant
:
IkasProductVariant
product
:
IkasProduct
initialQuantity
:
number
changeItemQuantityfunction
Changes the quantity of a cart item to the provided quantity.
async changeItemQuantity( item: IkasOrderLineItem, quantity: number )
item
:
IkasOrderLineItem
quantity
:
number
removeItemfunction
async removeItem(item: IkasOrderLineItem)
item
:
IkasOrderLineItem
findExistingItemfunction
Finds the existing item from the cart items. This function also takes product option values into account, it is recommended to use this function instead of searching the cart items array manually.
async findExistingItem(variant: IkasProductVariant, product: IkasProduct)
variant
:
IkasProductVariant
product
:
IkasProduct
removeCartfunction
removeCart()
saveCartfunction
For normal cart operations like adding/removing items, you wouldnt need this function. However for more advanced scenarios, you can use this function save the cart.
async saveCart(cart: IkasCart)
cart
:
IkasCart
getCartfunction
Cart data is automatically being fetched for you in the cartStore, but this function is also provided for more advanced scenarios. This functions sets the cart field in the cartStore.
async getCart()
saveCouponCodefunction
async saveCouponCode(couponCode?: string | null)
couponCode
:
string | null
removeCouponCodefunction
async removeCouponCode()
waitUntilInitializedfunction
Use this function to wait for the cart store initialization. The cart field will be filled if available.
waitUntilInitialized()