Skip to content

k.commerce ​

E-commerce module main entry.

Execution ContextPrerequisitesTypical Use
KScript API (k.api.get / k.api.post), server-side <script env="server">Enable Kooboo Commerce on the site and configure default currency/catalogAccess all 13 e-commerce sub-modules including products, carts, orders, and settings

k.commerce exposes the 13 e-commerce sub-modules for storefront and backend APIs.

Quick Start ​

js
k.api.get(() => {
    const categories = k.commerce.category.list()
    const products = k.commerce.product.list()
    return {
        defaultCurrency: k.commerce.currency.default,
        categoryCount: categories.length,
        productCount: products.length
    }
})

Quick Reference ​

Method / PropertyDescriptionReturns
productProducts, variants, digital items, and reviews -> productKProduct
categoryProduct category tree queries and CRUD -> categoryKCategory
cartCart creation, line items, and totals -> cartKCart
orderOrder creation, payment, delivery, and status updates -> orderKOrder
customerCustomer accounts, login, addresses, and OAuth -> customerKCustomer
loyaltyCustomer reward points and membership actions -> loyaltyKLoyalty
membershipMembership tier queries -> membershipKMembership
discountCoupon and automatic discount rules -> discountKDiscount
shippingPhysical and digital shipping methods -> shippingKShipping
addressCountry/province/city lists and detail resolution -> addressKAddress
wishlistCustomer wishlist items -> wishlistKWishlist
currencyMulti-currency rates and conversions -> currencyKCurrency
settingsGlobal commerce settings -> settingsSettings

TypeScript Definitions ​

ts
interface KCommerce {
    category: KCategory;
    product: KProduct;
    cart: KCart;
    order: KOrder;
    customer: KCustomer;
    loyalty: KLoyalty;
    discount: KDiscount;
    shipping: KShipping;
    address: KAddress;
    membership: KMembership;
    wishlist: KWishlist;
    currency: KCurrency;
    settings: Settings;
}