Commission rule
A commission rule scopes a rate to part of the catalog. It’s represented by theCommissionRule data model (table commission_rule, id prefix comrule). A
rule is a reference / reference_id pair that belongs to one rate. The
reference names the dimension, and the reference_id names the specific
record.
The five dimensions
A rule’sreference is one of five dimensions, each resolved against the order
line’s product:
Products are the shared master catalog. The
seller dimension resolves
through the offer on the order line (item.offer.seller_id), not through
product ownership.Most-specific-wins
When several rates match a line, resolution is AND across dimensions, OR within a dimension. Rules are grouped byreference. A rate matches only when
every group it defines has at least one matching rule. Among the matching
rates, the one scoped on the most distinct dimensions wins.
Tie-break
When two matching rates have equal specificity, the oldest rate wins. Rates are evaluatedcreated_at ascending, so the earliest-created rate is the
deterministic winner.
Shipping commission
Item commission is resolved per line as above. Shipping is different: a shipping method is commissioned only by the global rate, and only when itsinclude_shipping flag is on. No scoped rate can commission shipping.
include_tax is a separate, per-rate toggle. When on, the line’s tax_total
is added to the base amount before the rate is applied. This holds for both
item and shipping commission.