Margin Formulas
This page explains the math behind each pricing rule type and covers multi-currency, chaining, and rounding.
Cost plus percent
Section titled “Cost plus percent”sell_price = supplier_price × (1 + margin / 100)Example: Supplier price €100, margin 30%
sell_price = 100 × 1.30 = €130.00Why this is the recommended default:
If the supplier raises their price from €100 to €110:
sell_price = 110 × 1.30 = €143.00Your margin is always 30%. You don’t need to update pricing rules when suppliers change their prices.
Cost plus fixed
Section titled “Cost plus fixed”sell_price = supplier_price + amountExample: Supplier price €100, fixed margin €25
sell_price = 100 + 25 = €125.00Note: the margin percentage decreases as the supplier price increases:
- Supplier price €100 → sell €125 → margin 20%
- Supplier price €200 → sell €225 → margin 11.1%
Markup percent (chaining)
Section titled “Markup percent (chaining)”sell_price = base_price × (1 + value / 100)where base_price is the price calculated by the previous rule in the chain.
Example: Rule 1 sets cost_plus_percent 20%, Rule 2 adds markup_percent 5%:
base (supplier): €100after rule 1: €100 × 1.20 = €120.00after rule 2: €120 × 1.05 = €126.00Set price (hold price)
Section titled “Set price (hold price)”sell_price = value (fixed)Example: Hold price at €99.99 regardless of supplier cost.
Risk: If supplier cost rises above €99.99, you sell at a loss. Use the min_margin_percent guard rule to detect this:
| Supplier price | Hold price | Margin |
|---|---|---|
| €70.00 | €99.99 | 30% |
| €85.00 | €99.99 | 15% |
| €99.99 | €99.99 | 0% |
| €105.00 | €99.99 | −5% (blocked by guard) |
Rounding
Section titled “Rounding”Round to the nearest step. Applied as the last rule in a chain.
| Input | Round to | Direction | Result |
|---|---|---|---|
| €12.73 | 0.50 | nearest | €12.50 |
| €12.76 | 0.50 | nearest | €13.00 |
| €12.73 | 0.99 | floor to X.99 | €12.99 |
| €13.01 | 0.99 | floor to X.99 | €13.99 |
For psychological pricing (e.g. always end in .99), use round_to with value 0.99.
Multi-currency calculation
Section titled “Multi-currency calculation”When a supplier feed is in a different currency than the export destination:
supplier_price_local = supplier_price_foreign × fx_rate × (1 + fx_buffer / 100)Then pricing rules are applied to supplier_price_local.
Example:
- Supplier price: USD 120
- EUR/USD rate: 1.0870 → USD/EUR: 0.9200
- FX buffer: 1.5%
- Converted price: USD 120 × 0.9200 × 1.015 = EUR 112.06
- Cost-plus 30%: EUR 112.06 × 1.30 = EUR 145.68
The FX buffer provides a cushion against rate fluctuations between the time the rate was fetched and the time the export runs.
Rule chaining example
Section titled “Rule chaining example”A complex real-world rule chain:
| Priority | Condition | Action | Note |
|---|---|---|---|
| 1 | Brand = Nike | cost_plus_percent 40 | Premium margin |
| 2 | Category = Sale | markup_fixed −10 | Discount existing calculated price |
| 3 | Supplier = Wholesale A | cost_plus_percent 25 | Preferred supplier rate |
| 4 | (all) | cost_plus_percent 30 | Default |
| 5 | (all) | round_to 0.99 | Psychological pricing |
For a Nike product on sale (brand = Nike, category = Sale):
- Rule 1 matches: supplier €80 × 1.40 = €112
- Rule 2 matches on chained price: €112 − €10 = €102
- Rules 3 and 4 don’t apply (rule already set by rule 1)
- Rule 5 (round_to 0.99): €101.99
For a non-Nike, non-sale product from Wholesale A:
- Rule 1: no match
- Rule 2: no match
- Rule 3 matches: supplier €50 × 1.25 = €62.50
- Rule 4: no match (already set by rule 3)
- Rule 5: €61.99