Pricing rules
A discount engine that can express what you actually promised
Most systems give you a percentage box and a coupon code. Real offers are not shaped like that. “Buy five of the same item”, “spend a hundred thousand across these two categories”, “give away half my margin but never more” — Akkad's pricing engine is built to state each of those precisely, and to charge exactly what it previewed.
A pricing rule in Akkad is four decisions rather than one setting. You choose the scope — which categories the rule watches. You choose what it measures. You choose what it gives. And you write the thresholds at which it applies. Those four choices compose, which is why a small vocabulary covers a very large number of real offers.
The rule also chooses where it lives. Every rule carries a channel list, so a promotion can run on your storefront but not at the counter, on one landing page but nowhere else, or everywhere at once. In-store staff never have to remember which online offer is currently live, because the rule itself knows.
01
Four ways to measure, three ways to discount
The measurement decides when a rule fires. The discount type decides what it hands over. Any measurement can pair with any discount.
| Measures | What it watches | In practice |
|---|---|---|
| Fixed | Nothing — it fires whenever the cart contains anything in scope | “Everything in Electronics is 10,000 off.” |
| Per item count | The pooled piece count across all the rule's categories | “Buy ten items across Shirts and Trousers and the whole lot gets 15% off.” |
| Per order total | The cart's products total | “Spend 100,000 and take 10% off the goods in these categories.” |
| Per item quantity | Each product's own piece count, evaluated individually | “Buy five of the same product and that product gets 20% off.” |
Pooled and per-product counting are genuinely different offers. A cart holding five of item A and two of item B pools to seven — which discounts both under per item count, and only discounts A under per item quantity. Choosing the wrong one is the single most common way a promotion costs more than intended, so they are separate rule types rather than a checkbox.
| Gives | Calculated on | Notes |
|---|---|---|
| Fixed amount | A flat sum off the matched scope | Capped at the scope's own subtotal. |
| Percentage | A share of the matched scope's subtotal | Accepts 0–100. |
| Percentage of profit | A share of the matched scope's margin — sale price less cost | Lines with no recorded cost contribute nothing. Negative margins clamp to zero. |
02
Ladders, not switches
Thresholds are written as brackets — a minimum, an optional maximum, and the value to give. Leave the maximum open and the bracket means “and above”.
When a cart arrives, brackets are sorted by threshold from highest to lowest and the first one that matches wins. That ordering is what makes a ladder behave the way a merchant describes it out loud: five to nine pieces earns five percent, ten to nineteen earns ten, twenty and above earns fifteen. A cart of twelve takes the middle rung, not the bottom one it also technically satisfies.
- One rule can carry as many rungs as the offer needs.
- An open-ended top bracket means you never have to guess an upper bound.
- The bracket that fires is the highest one the cart qualifies for, never the first one written.
03
The interesting one
Discounting margin instead of price
Percentage-off is a blunt instrument, because the same percentage costs you wildly different amounts depending on the item. Twenty percent off a product carrying a sixty percent margin is a good day. Twenty percent off a product carrying an eighteen percent margin is a loss you agreed to in advance. Akkad lets a rule discount a share of margin instead, so a single promotion behaves differently on every line — generous where you can afford it, restrained where you cannot.
It never guesses a margin
A line with no recorded cost price contributes zero profit to the calculation. The engine will not invent a cost in order to be able to discount, because a wrong guess here comes directly out of your money.
Negative margins clamp to zero
An item priced below its cost — a loss leader, a data-entry slip — cannot pull the discount into strange territory. It simply contributes nothing.
Cost prices never reach the browser
A margin-based rule is deliberately withheld from the public storefront payload, because shipping the rule would let anyone reconstruct what you paid. The storefront asks the server for a quote instead, and the server runs the exact function that order creation runs.
04
Offers, and how you would express them
The clearest way to judge a pricing engine is to take offers you have actually run and check whether the system can state them without a compromise. These all compose from the vocabulary above.
| The offer | Measures | Gives | Written as |
|---|---|---|---|
| “Ten percent off everything in Cosmetics.” | Fixed | Percentage | One bracket at 10, scoped to Cosmetics. |
| “Buy three of any shirt, get twenty percent off those shirts.” | Per item quantity | Percentage | One bracket from 3 upward at 20, scoped to Shirts. |
| “Spend 150,000 across the whole store and take 15,000 off.” | Per order total | Fixed amount | One bracket from 150,000 upward, value 15,000. |
| “The more you buy, the better the rate — five, ten and twenty piece tiers.” | Per item count | Percentage | Three brackets: 5–9, 10–19, 20 and above. |
| “Clear the old stock, but never give away more than half my margin.” | Fixed | Percentage of profit | One bracket at 50, scoped to the clearance categories. |
| “Wholesale customers get a better price than the shop floor.” | Per item count | Percentage | A rule limited to the in-app channel, so the storefront never shows it. |
| “Online only, this weekend, on two categories at once.” | Fixed | Percentage | A rule scoped to both categories with the storefront channel selected, deactivated when the weekend ends. |
Each row is one rule. Because rules stack, an offer that combines two of these — a volume ladder running underneath a category-wide promotion — is simply both rules active at once, and the caps keep the combination safe.
05
What happens when rules overlap
Overlapping promotions are where discount engines usually go wrong, so the behaviour here is defined rather than emergent.
Rules stack, and the stack is summed
Several rules scoped to the same categories all fire, and their discounts add together. This is deliberate — a seasonal promotion and a volume ladder are separate commercial decisions and should both apply.
Every scope is capped at its own subtotal
A mistyped 150% or an oversized fixed amount can reduce a scope to zero and no further. A rule cannot push a line into negative money.
The grand total is capped at the products total
However many rules stack, the order cannot price below zero. The cap is applied identically by the preview and by order creation, so the two can never disagree.
Uncategorised lines earn nothing
Rules see the world through categories. A line with no category assigned is simply not in scope for any rule — which is predictable, if occasionally surprising the first time.
Old app builds are shown fewer rules, on purpose
Newer rule types cannot be evaluated by an older installed app. Rather than let an old build misread “five pieces” as “order total of at least five” — which would fire on nearly every order — the server withholds any rule the requesting build cannot understand. A staff member on an outdated version sees no discount rather than the wrong one, and the fix is simply to update.
06
The same answer everywhere
A discount is only trustworthy if the number the customer saw is the number you charge. Akkad guarantees that by making order pricing a single fixed sequence, executed the same way wherever it runs.
Products total first. Then rule discounts. Then shipping. Then tax, applied only to the taxable portion of the cart with the discount apportioned by the taxable share. Then the promo code. Then any custom amount. Cash rounding is always applied last, so it lands on the figure the customer actually hands over, and the result is floored at zero.
- The storefront shows a preview; the server recomputes the authoritative total at order creation.
- Percentage tax is capped at 100, so a typo cannot invent a charge.
- A positive total can never be rounded down to zero or below.
- 01Products total
- 02Apply discount rules
- 03Add shipping
- 04Tax — on the taxable subset only
- 05Subtract promo code
- 06Add custom amount
- 07Cash rounding — after every other adjustment
- 08Floor at zero — a guard, never a calculation
07
Promo codes
Codes are a separate lever from rules, and they combine with them rather than replacing them.
Additive to rule discounts
A code comes off after rules have applied, and is clamped to whatever subtotal remains. A customer with a good cart and a good code gets both, and still cannot reach a negative total.
Scoped per channel
A code can be valid on the storefront, on landing pages, at the counter, or any combination — the same channel model the rules use.
Validated before checkout
The storefront checks a code as it is typed, so a customer learns immediately whether it applies rather than at the moment they try to pay.
08
Questions
Can I run a rule only on my online store?
Yes. Every rule carries a channel list covering in-app orders, storefront orders and landing-page orders. A rule limited to the storefront is invisible to staff taking orders at the counter.
What stops two overlapping promotions from giving away the whole order?
Three caps, applied in order: each rule is capped at its own scope's subtotal, the combined discount is capped at the cart's products total, and the final order total is floored at zero. Stacking is allowed, but it cannot produce a negative charge.
How do pack sizes interact with a piece-count rule?
Discount rules count base pieces, so a box of twelve counts as twelve toward a piece threshold. Shipping rules deliberately count packs instead, because a box is one thing to carry. The two are different questions and are measured differently on purpose.
Does the customer see the discount before they commit?
Yes. The storefront quotes the cart against the live rules before checkout. Where a rule is margin-based, the quote comes from the server rather than the browser, so the calculation happens without ever exposing your cost prices.
Can a discount survive an order being edited later?
The discount applied is recorded on the order itself, so re-opening and adjusting an order does not silently re-price the parts you already agreed with the customer.
Related
Delivery pricing
The same bracket model applied to shipping cost, plus per-city rates and fuzzy city matching.
Sehen Sie es an Ihrem eigenen Katalog
Starten Sie mit dem passenden Tarif, importieren Sie Ihre Artikel aus einer Tabelle und haben Sie noch am selben Tag einen laufenden Shop, eine Theke und ein Auftragsbuch.
Kostenloser Tarif verfügbar. Zum Ausprobieren ist keine Karte nötig. Der Import bringt Ihren bestehenden Katalog mit.