Skip to content

Margin Formulas

This page explains the math behind each pricing rule type and covers multi-currency, chaining, and rounding.

sell_price = supplier_price × (1 + margin / 100)

Example: Supplier price €100, margin 30%

sell_price = 100 × 1.30 = €130.00

Why this is the recommended default:

If the supplier raises their price from €100 to €110:

sell_price = 110 × 1.30 = €143.00

Your margin is always 30%. You don’t need to update pricing rules when suppliers change their prices.

sell_price = supplier_price + amount

Example: Supplier price €100, fixed margin €25

sell_price = 100 + 25 = €125.00

Note: the margin percentage decreases as the supplier price increases:

  • Supplier price €100 → sell €125 → margin 20%
  • Supplier price €200 → sell €225 → margin 11.1%
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): €100
after rule 1: €100 × 1.20 = €120.00
after rule 2: €120 × 1.05 = €126.00
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 priceHold priceMargin
€70.00€99.9930%
€85.00€99.9915%
€99.99€99.990%
€105.00€99.99−5% (blocked by guard)

Round to the nearest step. Applied as the last rule in a chain.

InputRound toDirectionResult
€12.730.50nearest€12.50
€12.760.50nearest€13.00
€12.730.99floor to X.99€12.99
€13.010.99floor to X.99€13.99

For psychological pricing (e.g. always end in .99), use round_to with value 0.99.

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.

A complex real-world rule chain:

PriorityConditionActionNote
1Brand = Nikecost_plus_percent 40Premium margin
2Category = Salemarkup_fixed −10Discount existing calculated price
3Supplier = Wholesale Acost_plus_percent 25Preferred supplier rate
4(all)cost_plus_percent 30Default
5(all)round_to 0.99Psychological pricing

For a Nike product on sale (brand = Nike, category = Sale):

  1. Rule 1 matches: supplier €80 × 1.40 = €112
  2. Rule 2 matches on chained price: €112 − €10 = €102
  3. Rules 3 and 4 don’t apply (rule already set by rule 1)
  4. Rule 5 (round_to 0.99): €101.99

For a non-Nike, non-sale product from Wholesale A:

  1. Rule 1: no match
  2. Rule 2: no match
  3. Rule 3 matches: supplier €50 × 1.25 = €62.50
  4. Rule 4: no match (already set by rule 3)
  5. Rule 5: €61.99