A rate is a type and a value
A rate is aCommissionRate record (id prefix comrate). Its type says how to read its value, and two flags change the base amount the value applies to.
The base amount is the line’s
subtotal. A rate changes it with these flags:
include_tax: adds the line’stax_totalto the base before the rate appliesinclude_shipping: lets the rate commission shipping methods, and only takes effect on the global rateis_enabled: disabled rates are skipped during resolution
name and a unique code. When you create a rate without a code, the module builds one from the name plus a random suffix, so "Standard" becomes something like standard-k3x9qa.
Per-currency amounts for fixed rates
A fixed rate holds one amount per currency inCommissionRateValue records (id prefix comval). During resolution, Mercur picks the value whose currency_code equals the order’s currency. When none matches, it uses the rate’s own value.
Percentage rates ignore values, because a percent is the same in every currency. A rate’s own currency_code field is separate: when it’s set, the rate only applies to orders in that currency.
Rules scope a rate
A rule is aCommissionRule record (id prefix comrule) that belongs to one rate. It’s a reference naming a dimension and a reference_id naming the record, for example seller and sel_01JD8Q1234567. A rate without rules matches every line. A rate with rules matches only the lines that satisfy them.
The five dimensions are:
product: a master product idproduct_type: a product type idproduct_collection: a collection idproduct_category: a category idseller: the seller of the offer on the order line
The global commission
The global commission is the rate withis_default: true. The module seeds it on boot when none exists, as a 0% percentage rate named Default with the code default. You raise it to set the marketplace’s baseline cut.
The global rate has rules that set it apart:
- Always present:
deleteCommissionRatesWorkflowthrowsNOT_ALLOWEDif you try to delete it - Fallback for items: it has no rules, so it matches every line and loses to any scoped rate that also matches
- Only shipping rate: its
include_shippingflag is the only one that produces shipping commission lines
Nothing stops you from setting
include_shipping on a scoped rate, but the flag has no effect there. Shipping is resolved from the global rate alone.