> For the complete documentation index, see [llms.txt](https://teamleader-sdk.mcore-services.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teamleader-sdk.mcore-services.dev/api-reference/invoicing/commercial-discounts.md).

# Commercial Discounts

Manage commercial discounts in Teamleader Focus.

```php
Teamleader::commercialDiscounts()
```

|                          |                                                                       |
| ------------------------ | --------------------------------------------------------------------- |
| Class                    | `McoreServices\TeamleaderSDK\Resources\Invoicing\CommercialDiscounts` |
| Create / update / delete | — / — / —                                                             |
| Pagination               | No                                                                    |

## Endpoints

* `commercialDiscounts.list`

## Filters

Passed as the first argument to `list()`. Any other key throws.

| Filter          | Description               |
| --------------- | ------------------------- |
| `department_id` | Filter by department UUID |

## Methods

### `list()`

```php
list(array $filters = [], array $options = []): array
```

List commercial discounts with optional filtering

The endpoint accepts a department\_id filter but no sorting or pagination, so those arguments are rejected rather than discarded.

* `$filters` — department\_id
* `$options` — Must be empty — no sorting or pagination

**Throws** `\InvalidArgumentException` When an unsupported argument is passed

### `forDepartment()`

```php
forDepartment(string $departmentId): array
```

Get commercial discounts for a specific department

* `$departmentId` — Department UUID

### `findByName()`

```php
findByName(string $name, ?string $departmentId = null, bool $exactMatch = true): ?array
```

Find a commercial discount by name

* `$name` — Discount name to search for
* `$departmentId` — Optional department filter
* `$exactMatch` — Whether to match exactly or search partial

### `asOptions()`

```php
asOptions(?string $departmentId = null): array
```

Get commercial discounts formatted as options for select dropdowns

Keyed by discount UUID. Teamleader added `id` to the commercialDiscounts.list response in July 2026; before that the endpoint returned only name and department, so this method used the name as its own key and two discounts sharing a name across departments collapsed into one entry.

* `$departmentId` — Optional department filter

### `groupedByDepartment()`

```php
groupedByDepartment(): array
```

Get commercial discounts grouped by department

### `exists()`

```php
exists(string $name, ?string $departmentId = null): bool
```

Check if a commercial discount exists by name

* `$name` — Discount name
* `$departmentId` — Optional department filter

### `search()`

```php
search(string $searchTerm, ?string $departmentId = null): array
```

Search for commercial discounts by partial name match

* `$searchTerm` — Search term to match against discount names
* `$departmentId` — Optional department filter

### `names()`

```php
names(?string $departmentId = null): array
```

Get all discount names as a simple array

* `$departmentId` — Optional department filter

### `find()`

```php
find(string $id): ?array
```

Find a commercial discount by ID

The endpoint has no info() counterpart, so this resolves against the list. `id` was added to the commercialDiscounts.list response in July 2026.

* `$id` — Commercial discount UUID

### `getResponseStructure()`

```php
getResponseStructure(): array
```

Get response structure documentation

## Examples

Get all commercial discounts:

```php
$discounts = Teamleader::commercialDiscounts()->list();
```

Get commercial discounts for a specific department:

```php
$discounts = Teamleader::commercialDiscounts()->forDepartment('department-uuid');
```

Find a commercial discount by name:

```php
$discount = Teamleader::commercialDiscounts()->findByName("Holiday discount");
```

Get commercial discounts as key-value pairs for dropdowns:

```php
$options = Teamleader::commercialDiscounts()->asOptions();
```
