k.commerce
E-commerce module main entry.
| Execution Context | Prerequisites | Typical Use |
|---|---|---|
KScript API (k.api.get / k.api.post), server-side <script env="server"> | Enable Kooboo Commerce on the site and configure default currency/catalog | Access 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 / Property | Description | Returns |
|---|---|---|
product | Products, variants, digital items, and reviews -> product | KProduct |
category | Product category tree queries and CRUD -> category | KCategory |
cart | Cart creation, line items, and totals -> cart | KCart |
order | Order creation, payment, delivery, and status updates -> order | KOrder |
customer | Customer accounts, login, addresses, and OAuth -> customer | KCustomer |
loyalty | Customer reward points and membership actions -> loyalty | KLoyalty |
membership | Membership tier queries -> membership | KMembership |
discount | Coupon and automatic discount rules -> discount | KDiscount |
shipping | Physical and digital shipping methods -> shipping | KShipping |
address | Country/province/city lists and detail resolution -> address | KAddress |
wishlist | Customer wishlist items -> wishlist | KWishlist |
currency | Multi-currency rates and conversions -> currency | KCurrency |
settings | Global commerce settings -> settings | Settings |
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;
}