> ## Documentation Index
> Fetch the complete documentation index at: https://pricepirate.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Minimum margin

> How the minimum-margin variant derives a price floor from cost, tax, and fees.

The **minimum margin** variants of the strategies ([Match The Cheapest](/docs/en/guide/pricing/match-the-cheapest) and [Beat The Cheapest](/docs/en/guide/pricing/beat-the-cheapest)) replace the fixed minimum price with a price floor calculated from your costs and a target margin. This keeps every automatic price change profitable.

## Requirement: unit cost in Shopify

The margin calculation needs the cost per item. PricePirate reads the variant's **cost per item** from Shopify.

<Warning>
  If a minimum margin is enabled but no valid unit cost is set in Shopify (and no manual value is provided), **no** price change is created. Set the cost per item in Shopify, or fill in the **Unit cost override** field.
</Warning>

## The calculation

From unit cost, fixed cost, sales tax, and transaction fee, the price floor is determined as:

```text theme={null}
netRevenueFactor = 1 / (1 + salesTaxRate) − transactionFeeRate
marginFloor       = (cost + fixedCost) × (1 + minMargin) / netRevenueFactor
```

Rates are entered as decimals (19% = 0.19; 3% = 0.03; 20% margin = 0.20). Your **shipping cost** is additionally credited as shipping revenue, lowering the required product-price floor accordingly.

## Worked example

Assumptions: unit cost 10.00 €, fixed cost 2.00 €, minimum margin 20%, sales tax 19%, transaction fee 3%, no shipping cost.

1. netRevenueFactor = 1 ÷ 1.19 − 0.03 = 0.8403 − 0.03 = **0.8103**
2. Cost base = (10.00 + 2.00) × 1.20 = **14.40 €**
3. Margin floor = 14.40 ÷ 0.8103 = **≈ 17.77 €**

So PricePirate would never lower the price below \~17.77 €, even if a competitor is cheaper.

<Note>
  The higher of the calculated margin floor and any other limit always wins. If a configured **maximum price** is below the margin floor, no valid price can be calculated and no change is created.
</Note>

## Availability

Minimum margin is available as the **"with minimum margin"** variant of both strategies:

<Columns cols={2}>
  <Card title="Match The Cheapest" href="/docs/en/guide/pricing/match-the-cheapest">
    "With minimum margin" variant.
  </Card>

  <Card title="Beat The Cheapest" href="/docs/en/guide/pricing/beat-the-cheapest">
    "With minimum margin" variant.
  </Card>
</Columns>
