Skip to main content
The Commission module defines no module links. None of the files in packages/core/src/links has a commission side. Rules and lines point at records in other modules through plain id fields, which Mercur resolves at calculation time or which you filter on directly.

Rules point at the catalog and sellers

A CommissionRule names its target with reference and reference_id. The refreshOrderCommissionLinesWorkflow reads the target’s fields from the order with query.graph, so the commission records never need a link. The seller row goes through the order-line-item-offer-link from the Offer module. Products belong to the shared catalog, so the seller of a line is the seller of the offer the customer bought.

Lines point at order items and shipping methods

A CommissionLine stores item_id or shipping_method_id as plain text. To get an order’s lines, collect the ids from the order, then filter commission_line by them.
createOrderPayoutsWorkflow and the order commission-lines routes read lines the same way.

Lines point at their rate

commission_rate_id on a line is also plain text, not a relation. Query the rate separately if you need more than the code the line already stores.
Plain ids don’t cascade. Deleting a product, category, or seller leaves its rules in place, where they stop matching. Deleting a rate soft-deletes it and leaves existing lines untouched.