Inventory & Products | Products | Attributes

Attributes (Product Options)

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).

The model

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
  • Attribute — a question ("Included toppings?"). An attribute with no predefined values is a free-text attribute.
  • Attribute values — the offered answers ("Salami", "Onion").
  • Attribute set — a named group of attributes ("Pizza options") that products attach. A set can be shared by many products, and since platform v3.83 a product can attach multiple sets.
  • Attribute use — the row that puts an attribute INTO a set with its picker rules: selection type (single choice / multi select), default selections, max allowed options (0 = unlimited), and since v3.128/v3.129 the group's lock and included-options pricing flags (below).

Where it is set up (CMS product editor)

Everything lives in the product editor's Attributes tab (Ominaisuudet):

  1. Attach sets — the multi-select at the top attaches one or more attribute sets to the product, in order. The first attached set is what the cash register carries.
  2. Build the sets — the builder under it manages the set definitions themselves (tenant-global, shared across products): add/rename attributes, add values, pick selection type, tick defaults, set max options. Every option can also carry a net price, a discount % and a picture (v3.128) — prices and pictures belong to the option itself and apply everywhere the attribute is used. Groups are private to their set: a group name that already exists in another set is added as an independent duplicate (all options copied, nothing shared), and the Attributes page's Duplicate button clones a whole set into an independent copy the same way.
  3. Ask at sale — the Ask for attribute values switch (isverpatrib) makes order/invoice lines ask for the selections when the product is added.
  4. Preview — the POS preview button shows the picker exactly as the sales screen will render it.

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).

Per-product rules (v3.119)

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).

Lock, Max and included options (v3.128–v3.129)

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):
    • unlocked group — the free count follows the customer: the first N selected options (counted in the group's option order) are free, whichever options they are; the customer can swap freely which options fill the free slots.
    • locked group — the free set is pinned to the default_value_ids (capped at N): they cannot be changed and always ring 0, everything else charges.
    • fail-safes: an unlocked group with 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.

API endpoints

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.