Associations

Association types and product associations — cross-sells, accessories, spare parts and quantified relations such as bundles and bills of materials.

An association is a typed link from one product to another: an accessory, a spare part, a cross-sell, a component of a bundle.

EntityBase pathIs
association_types/v1/products/association_typesThe kind of relation
product_associations/v1/products/product_associationsOne link, source → target

Association types

Association type
{
  "code": "accessory",
  "labels": { "en": "Accessories", "de": "Zubehör" },
  "is_two_way": true,
  "is_quantified": false
}
FieldMeaning
codeUnique per tenant.
labelsWhat the relation is called in a product form, per language tag.
is_two_wayDeclares the relation symmetric — an accessory of A is an accessory of B.
is_quantifiedDeclares that a relation of this kind carries a quantity.
is_two_way is a declaration a client reads, not behaviour the app performs. This app stores one row per direction and does not create the mirror for you. If you want the reverse link to exist as a row, write it.

Product associations

Association
{
  "product_id": "",
  "association_type_id": "",
  "target_product_id": "",
  "position": 10
}
FieldMeaning
product_idThe product the relation starts at — the one whose detail page shows it.
target_product_idThe product it points at — the accessory, the spare part, the cross-sell.
association_type_idWhich kind of relation.
positionOrder in which targets are shown, ascending.
quantityHow many of the target belong to the source.

Quantified relations

quantity is the 4 in "this bundle contains 4 casters". It is only meaningful when the association type carries is_quantified — on an ordinary cross-sell it is null.

Association type
{ "code": "bundle_component", "is_quantified": true, "is_two_way": false }
Association
{ "product_id": "<bundle>", "association_type_id": "", "target_product_id": "<caster>", "quantity": 4 }

That pair is how a bundle or a bill of materials is expressed. Nothing in the catalog prices or explodes a bundle for you — the quantity is data for whatever does.

The products row also carries a quantified_associations jsonb column, kept for catalogs imported with one. The entities above are the surface this app reads and writes.

Where to go next

  • Products — the rows on both ends of a link.
  • Categories — the other way products are grouped.
  • Order lists — reusable position collections, which are not associations.
Was this page helpful?