Attributes are free options a merchant can offer on products — toppings on a pizza, meal bases, included drinks. This page explains the concept and the CMS setup; the API endpoints are documented separately (links at the bottom).
Attribute sets Attributes Attribute values
|____ Pizza options |____ Included toppings |____ Salami
|____ Meal options | |____ Onion
|____ Included drinks |____ CocaCola 250 ML
| |____ Fanta 250 ML
|____ Meal base |____ Rice
|____ Noodles
Everything lives in the product editor's Attributes tab (Ominaisuudet):
isverpatrib) makes order/invoice lines ask for the selections when the product is added.At sale time each selection becomes its own sub-line under the product line (labelled "Attribute: value"), so receipts and invoices show the choices. A sub-line is free (0) unless its option carries a net price — a priced option rings its own line (net price + the option's discount %, VAT from the product).
The set's rules are its shared defaults — but every product can carry its own. On the Attributes tab, the selection dropdown, max, the default checkboxes, the lock and the included-pricing switch write this product's override, while every other product on the same set keeps the shared defaults. The API reads the effective values (get_product_attributes product mode) and writes the overrides (set_product_attributes use_rules).
Three fields on every group decide what the selections cost at the sale — on the register's sales screen, in the CMS order/invoice editors and in any client built on this API:
max_allowed_options — on a multi-select group, the maximum number
of selectable options (0 = unlimited). In included-pricing mode it
changes meaning: it is the count of FREE options, not a selection cap.locked — 1 = the group is frozen at the sale for every user,
in every role (there is no admin/manager exemption): the
default_value_ids apply to every sale and cannot be added to, removed
from or changed. A product whose groups are all locked shows no picker
at all — the defaults apply silently. The CMS builder keeps
max_allowed_options >= the number of defaults at all times; API
clients writing use_rules should keep the same invariant.included_pricing (multi select only) — 1 = included-options
pricing: the first max_allowed_options selections ring 0 (even when
priced) and everything beyond charges the option's price (options
without a price never charge):
default_value_ids
(capped at N): they cannot be changed and always ring 0, everything
else charges.max_allowed_options 0
includes nothing (everything charges); a locked group with 0
includes all its selected defaults; single-choice groups ignore the
mode.Pricing rule for client implementations (mirror of the CMS resolver):
// $selected = the group's picked value_ids, in the group's option order
// N = effective max_allowed_options (0 = unlimited), LK = locked flag
$free = []; $quotaSeen = 0; $defSeen = 0;
foreach ($selected as $vid) {
if ($LK) {
$isFree = isset($defaults[$vid]) && ($N <= 0 || $defSeen < $N);
if ($isFree) { $free[$vid] = true; $defSeen++; }
} else {
if ($N > 0 && $quotaSeen < $N) { $free[$vid] = true; $quotaSeen++; }
}
}
// charge = in_array($vid, $free) ? 0 : max((float)$price, 0);
The CMS keeps every consumer of these fields in sync (register sync, CMS pickers, mobile API) — when implementing against this API, resolve the free set at display/pricing time exactly as above instead of zeroing stored prices.## Multilingual texts
Set, attribute and value names can be entered per language (the pencil icons open a language-tabs editor). The public API returns both the resolved text and the raw {lang_code: text} map (name / name_ml) so clients can localize.
| Endpoint | Purpose |
|---|---|
| get_product_attributes | Read the tenant's set/attribute/value catalog (with option prices, locks and pricing modes), or one product's attached sets, flags and EFFECTIVE per-product rules |
| set_product_attributes | Attach/detach sets on a product (replace-all, ordered), set the ask-at-sale flag, and write per-product rule overrides (use_rules) |
Set definitions (creating sets/attributes/values) are maintained in the CMS Attributes tab — the API attaches existing sets to products.