percentage
Keyword
percentage(target: Target | [Target], rate: number): CalculatedDiscount The percentage keyword creates a percentage discount effect. It takes a target (from target or order) and a percentage rate, and returns a discount effect record.
The rate uses Filtrera's percentage syntax: 10% equals 10 percent, 100% equals 100 percent.
Availability
| Promotion | Rule | Reactor |
|---|---|---|
| ✓ |
Examples
10% off the entire order
filtrera
from percentage(order, 10%)Free shipping (100% off deliveries)
filtrera
from percentage(target(e => e is Delivery), 100%)20% off specific products
filtrera
from percentage(target(e => e is OrderLine and e.dynamic->'category' == 'electronics'), 20%)Conditional percentage based on order value
filtrera
let rate = order.total match
when order.total >= 10000 |> 15%
when order.total >= 5000 |> 10%
when order.total >= 1000 |> 5%
|> 0%
from rate > 0% match
true |> percentage(order, rate)
false |> nothingSee Also
- absolute — apply a fixed amount discount
- target — select which parts of the order to discount
- order — target the entire order
- Order Promotions — how promotions work