The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.
TypeScript b2b-marketplacecomposable-commerceecommerceenterpriseheadless-commercemarketplacemedusamedusajsmulti-vendortypescript
---
title: "Commission links to other modules"
sidebarTitle: "Links"
description: "Commission defines no module links. Rules and lines reference the catalog, sellers, and orders by plain id."
---
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.
| `reference` | Points at | Read from the order line |
| --- | --- | --- |
| `product` | A master product | `items.product.id` |
| `product_type` | A product type | `items.product.type_id` |
| `product_collection` | A product collection | `items.product.collection_id` |
| `product_category` | A product category | `items.product.categories.id` |
| `seller` | A seller | `items.offer.seller_id` |
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.
```ts
const { data: [order] } = await query.graph({
entity: "order",
fields: ["items.id", "shipping_methods.id"],
filters: { id: "order_01JD8Q1234567" },
})
const { data: lines } = await query.graph({
entity: "commission_line",
fields: ["item_id", "shipping_method_id", "code", "amount"],
filters: {
$or: [
{ item_id: order.items.map((item) => item.id) },
{ shipping_method_id: order.shipping_methods.map((m) => m.id) },
],
},
})
```
`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.
<Note>
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.
</Note>