Modules
Product Variants
Sizes, colors and other attributes of a model product. Each variant is a product.
Overview
The company defines attributes (Size, Color...) and their values. A model product gets its variants by combining values: each variant is a product of its own (itm_...) with its code, barcode, price and stock, so it is sold, invoiced and moved like any product. Its name is the model plus the values, for example Polo · M · Black.
Requires the Product variants module. An owner or admin turns it on in Settings > Modules. While it is off, every endpoint on this page returns 403 with type permission_error and code module_disabled.
Endpoints
| Method | Path | Permission | Description |
|---|---|---|---|
GET | /v1/variant-attributes | read | Attributes with their values |
POST | /v1/variant-attributes | write | Create an attribute (name, kind: text or color) |
POST | /v1/variant-attributes/{id}/values | write | Add a value (name, code, color_hex) |
GET | /v1/products/{id}/variants | read | Variants of a model with their stock; variant_of when the product is a variant |
POST | /v1/products/{id}/variants | write | Generate the missing combinations |
Generate Variants
Bash
TypeScript
{size}and{color}are the attribute names; each one is replaced by the valuecode- Combinations that already exist are skipped (
skipped); up to 300 per call - New variants copy the unit, currency, tax, cost, category and brand of the model, and start with zero stock
- Once a model has variants, new ones must use the same attributes