Skip to content

wishlist

wish list

Overview

k.commerce.wishlist provides wish list related operations for managing customers' product collection lists.

list()

Gets a list of the specified customer's wish lists.

ts
k.api.get(() => {
    const customer = k.commerce.customer.getByEmail("test@kooboo.com")
    return k.commerce.wishlist.list(customer.id)
})

parameter:

ParameterTypeRequiredDescription
customerIdstringyesCustomer ID

Return: WishlistItem[]

add()

Add an item to a specified customer's wish list.

ts
k.api.get(() => {
    const customer = k.commerce.customer.getByEmail("test@kooboo.com")
    const variantId = k.commerce.product.get("test-product").variants[0].id
    k.commerce.wishlist.add(customer.id, variantId)
    return "add success"
})

parameter:

ParameterTypeRequiredDescription
customerIdstringyesCustomer ID
variantIdstringyesProduct variant ID

Return: void

remove()

Removes an item from the specified customer's wish list.

ts
k.api.get(() => {
    const customer = k.commerce.customer.getByEmail("test@kooboo.com")
    const variantId = k.commerce.product.get("test-product").variants[0].id
    k.commerce.wishlist.remove(customer.id, variantId)
    return "remove success"
})

parameter:

ParameterTypeRequiredDescription
customerIdstringyesCustomer ID
variantIdstringyesProduct variant ID

Return: void

structure

WishlistItem Property

PropertyDescriptionType
customerIdCustomer IDstring
productIdProduct IDstring
variantIdVariant IDstring