Products & Catalog
zr.products manages catalog products; zr.categories, zr.receipts, and zr.stockMovements cover the rest of the catalog.
Products
ts
const page = await zr.products.search({ pageSize: 20, keyword: 'widget' });
// get is a POST-by-id operation with an options body (do not treat it as GET):
const product = await zr.products.get(id, { includeWarehouseStock: true });
const created = await zr.products.create({
name: 'Widget',
sku: 'SKU-001',
localStock: 100,
basePrice: 1500,
});
await zr.products.update(id, { /* UpdateProductRequest */ });
await zr.products.updatePrice(id, { /* … */ });
await zr.products.updateDiscount(id, { /* … */ });
await zr.products.updateLocalStock(id, { /* … */ });
await zr.products.delete(id);An empty catalog is possible
On some tenants products.search returns 0 even though parcels reference real product ids. When you need a productId for parcel creation but the catalog search is empty, resolve one from an existing parcel's orderedProducts (fetch a parcel with parcels.get) — see API Quirks §9.13.
Excel import
ts
const result = await zr.products.import({ file: excelBlob, fileName: 'products.xlsx' });
const template = await zr.products.downloadImportTemplate(); // ArrayBufferCategories
ts
const categories = await zr.categories.search({ pageSize: 50 });Receipts
ts
const receipts = await zr.receipts.search({ pageSize: 20 });
const receipt = await zr.receipts.get(id);Stock movements
ts
await zr.stockMovements.createByUser({ /* CreateProductStockMovementUserRequest */ });See the API Reference for every method and type.