---
title: "Discount types & composing — Coupons for Laravel | Roundly"
description: "The DiscountType enum — labels for admin UIs, conversion to a money Discount, and combining coupons with other discounts in a DiscountStack."
url: https://roundly-consulting.com/open-source/docs/coupons-for-laravel/discount-types
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Coupons for Laravel](https://roundly-consulting.com/open-source/docs/coupons-for-laravel.md)

# Discount types & composing

The string-backed DiscountType enum names how a coupon’s value applies; the math itself belongs to money-for-laravel’s Discount:

| Case | Value | Stored value means |
| --- | --- | --- |
| `Fixed` | `fixed` | Minor units of the coupon’s currency. |
| `Percentage` | `percentage` | Basis points (2500 = 25 %). |
| `FreeShipping` | `free_shipping` | Ignored — a marker for the host’s shipping line. |

```php
use RoundlyConsulting\Coupons\Enums\DiscountType;
use RoundlyConsulting\Money\Currency;
use RoundlyConsulting\Money\Money;

$eur = Currency::of('EUR');

DiscountType::Fixed->toDiscount(250, $eur)->applyTo(Money::ofMinor(1000, 'EUR'));        // 7.50 EUR
DiscountType::Percentage->toDiscount(1250, $eur)->amountFor(Money::ofMinor(999, 'EUR'));  // 1.25 EUR (12.5 %, half away from zero)
DiscountType::Percentage->toDiscount(5000, $eur, cap: Money::ofMinor(300, 'EUR'));       // 50 % capped at 3.00 EUR

// Free shipping is a discount on the SHIPPING target — route by $discount->target(); never
// apply it to the price of the goods.
DiscountType::FreeShipping->toDiscount(0, $eur)->target(); // DiscountTarget::Shipping

// Translatable labels and descriptions for admin UIs:
DiscountType::Percentage->label();            // "Percentage"
DiscountType::Percentage->description();      // "Subtracts a percentage of the price."
DiscountType::FreeShipping->requiresValue();  // false (Fixed/Percentage are true)
```

## Admin labels

label() and description() are translated through coupons::messages.type.\*, so building a select for an admin form is one line:

```php
collect(DiscountType::cases())->mapWithKeys(fn ($t) => [$t->value => $t->label()]);
// Collection: ['fixed' => 'Fixed amount', 'percentage' => 'Percentage', 'free_shipping' => 'Free shipping']
```

## Composing with other discounts

Coupon::discount(Currency $for) hands you the coupon as a money Discount — labelled with the code, capped at max\_discount, and in the coupon’s own currency when it’s locked. Combine it with other discounts in a DiscountStack:

```php
use RoundlyConsulting\Money\Currency;
use RoundlyConsulting\Money\Discounts\Discount;
use RoundlyConsulting\Money\Discounts\DiscountStack;
use RoundlyConsulting\Money\Money;

$subtotal = Money::ofMinor(8000, 'EUR');
$shipping = Money::ofMinor(500, 'EUR');
$loyalty  = Discount::percentage(5)->labelled('Loyalty');

$breakdown = DiscountStack::of(
    $coupon->discount(Currency::of('EUR')),
    $loyalty,
)->apply($subtotal, $shipping);

$breakdown->discountedSubtotal();
$breakdown->discountedShipping();   // a free-shipping coupon targets shipping here
$breakdown->total();
```

A free-shipping coupon yields a shipping-target discount, so it lands on the shipping line of the breakdown, never on the goods. DiscountType::toDiscount(int $value, Currency $currency, ?Money $cap = null) builds the same Discount from raw values.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/coupons-for-laravel.md)
