IkasCartStore
Refer to the IkasCart reference.
isLoadingCartbooleanisCartLoadFinishedbooleancheckoutIdbooleancheckoutUrlbooleanaddItemfunctionAdds 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
changeItemQuantityfunctionChanges the quantity of a cart item to the provided quantity.
async changeItemQuantity( item: IkasOrderLineItem, quantity: number )
item
:
IkasOrderLineItem
quantity
:
number
findExistingItemfunctionFinds 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
saveCartfunctionFor 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
getCartfunctionCart 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()
waitUntilInitializedfunctionUse this function to wait for the cart store initialization. The cart field will be filled if available.
waitUntilInitialized()