Products
A product is the sellable item: its name and description, its price and cost, its inventory, shipping attributes, tax rules, brand, and any custom attributes the category defines. Price ultimately lives on a variant — every product has at least one — so a single product can carry many SKUs while sharing one description and image set.
In the TypeScript SDK a product is created together with its required variants (the response is the hydrated product with resolved stock status and priceRange). In the Python SDK, create sets inventory directly on the product via stock_quantity and related fields.
Create a product
- TypeScript
- Python
const tshirt = await client.products.create({
categoryId: 'category_apparel',
name: 'Classic T-Shirt',
description: 'Comfortable cotton t-shirt',
price: 24.99,
sku: 'TS-CLASSIC',
trackInventory: true,
isActive: true,
isAlcoholic: false,
variants: [
{ axisValues: { Size: 'Small', Color: 'Black' }, price: 24.99, isDefault: true, isActive: true },
{ axisValues: { Size: 'Medium', Color: 'Black' }, price: 24.99, isDefault: false, isActive: true },
{ axisValues: { Size: 'Large', Color: 'Black' }, price: 26.99, isDefault: false, isActive: true },
],
});
console.log(`Created ${tshirt.name} with ${tshirt.variants.length} variants`);
from wiil.models.business_mgt import CreateBusinessProduct
product = client.products.create(
CreateBusinessProduct(
name="Wireless Mouse",
description="Ergonomic wireless mouse with 6 buttons",
price=29.99,
sku="WM-2024-BLK",
barcode="123456789012",
category_id="category_accessories",
brand="TechBrand",
track_inventory=True,
stock_quantity=150,
low_stock_threshold=20,
weight=0.25,
is_active=True,
)
)
Get, list, update, delete
- TypeScript
- Python
const product = await client.products.get('product_123');
const result = await client.products.list();
const updated = await client.products.update({ id: 'product_123', price: 179.99 });
await client.products.delete('product_123');
from wiil.models.business_mgt import UpdateBusinessProduct
from wiil.types import PaginationRequest
by_id = client.products.get("product_123")
by_sku = client.products.get_by_sku("WH-2024-BLK")
results = client.products.list(params=PaginationRequest(page=1, page_size=50), include_deleted=False)
updated = client.products.update(
UpdateBusinessProduct(id="product_123", price=179.99, stock_quantity=100)
)
client.products.delete("product_123")
The Python SDK looks products up by SKU with get_by_sku; in TypeScript, SKU lookup is a variant operation.
Batch create
- TypeScript
- Python
const result = await client.products.createBatch([
{
categoryId: 'cat_accessories',
name: 'Wireless Mouse',
description: 'Ergonomic wireless mouse',
price: 29.99,
sku: 'WM-001',
trackInventory: true,
isActive: true,
isAlcoholic: false,
variants: [{ axisValues: {}, price: 29.99, isDefault: true, isActive: true }],
},
{
categoryId: 'cat_accessories',
name: 'Mechanical Keyboard',
description: 'RGB backlit mechanical keyboard',
price: 89.99,
sku: 'KB-001',
trackInventory: true,
isActive: true,
isAlcoholic: false,
variants: [{ axisValues: {}, price: 89.99, isDefault: true, isActive: true }],
},
]);
from wiil.models.business_mgt import CreateBusinessProduct
products = client.products.create_batch([
CreateBusinessProduct(name="Wireless Earbuds", description="Bluetooth 5.0 earbuds", price=79.99, sku="ELEC-001", category_id="cat_electronics", is_active=True),
CreateBusinessProduct(name="Cotton T-Shirt", description="100% cotton", price=24.99, sku="CLTH-001", category_id="cat_clothing", is_active=True),
CreateBusinessProduct(name="Leather Wallet", description="Genuine leather bifold", price=49.99, sku="ACCS-001", category_id="cat_accessories", is_active=True),
])
Both SDKs cap batch creation at 100 products per request.
BusinessProduct fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | auto | Unique identifier |
name | string | Yes | Product name (min 1 character) |
description | string | null | No | Detailed description |
price | number | Yes | Base price (≥ 0) |
cost | number | null | No | Cost of goods for margin calculation |
compareAtPrice | number | null | No | Original price for sale display |
categoryId | string | Yes | Parent category (optional on create) |
sku | string | null | No | Stock Keeping Unit |
skuPattern | string | null | No | SKU template for variant generation |
barcode | string | null | No | Product barcode |
barcodeFormat | enum | null | No | UPC_A, EAN_13, CODE_128, QR, … |
brand / brandId | string | null | No | Brand name and reference |
tags | array | null | No | Search/filter tags |
imageUrl / imageUrls | string | null | No | Primary and gallery images |
isAlcoholic | boolean | No | Triggers age verification (default false) |
trackInventory | boolean | No | Whether inventory is tracked (default false) |
stockQuantity | integer | null | No | Current available stock |
lowStockThreshold | integer | null | No | Low-inventory alert threshold |
reorderPoint / leadTime / supplierId | — | No | Replenishment planning |
weight | number | null | No | Shipping weight |
dimensions | object | null | No | length, width, height, unit (inches/cm) |
shippingClassId / HSCode | string | null | No | Shipping class and customs code |
taxRuleIds | array | null | No | Tax rules (override category) |
attributes | array | null | No | Custom attribute values |
isActive | boolean | No | Available for sale (default true) |
displayOrder | integer | null | No | Order within category |
orderCount / recentOrderCount / lastOrderedAt | — | read-only | Server-computed analytics |
Every product must have at least one variant — price and per-SKU stock live on the variant. The TypeScript SDK creates variants inline (and exposes a dedicated variants & axes resource); the Python create sets stock_quantity and pricing on the product directly.
Query options
BusinessProduct queries filter by search, locationId, categoryId, isActive, brand, brandId, trackInventory, priceRange, lowStock, isAlcoholic, and tags, sorted by name, price, createdAt, or displayOrder (asc / desc), with page/pageSize pagination.
Track cost for margin analysis, set reorderPoint and leadTime for replenishment alerts, and mark isAlcoholic so age verification triggers in the order flow.