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

# Excluding buyers with a customer discount from a voucher

> Make a voucher valid only for customers who have no discount stored in their account, so that promotional and permanent discounts do not add up.

Customers with a stored discount receive their reduction anyway. If such a customer also redeems a promotional voucher, both benefits add up and the margin drops further than planned. With this function, you exclude these customers from a voucher promotion.

## What counts as a customer discount

The shop checks four entries in the customer account. **Any one of them is enough** for the voucher to be rejected.

| Entry | Meaning |
| - | - |
| Product discount | a discount rate on products |
| Order discount | a discount rate on the order |
| Product discount list | a tiered discount assignment for products |
| Order discount list | a tiered discount assignment for orders |

> [!NOTE]
>
> Other benefits in the customer account do not count here. A customer with reduced shipping or payment costs or with permanent free shipping is treated as a customer without a discount for this check and can redeem the voucher.

> [!WARNING]
>
> The check only applies to logged-in customers. If the same person orders as a guest without logging in, the restriction does not apply, because the shop does not know the account and therefore the discount. Where guest orders are permitted, the exclusion can thus be circumvented. If this matters for your promotion, require login for the order.

## Prerequisite

The voucher generator must be activated. Contact your WEBSALE representative to arrange this.

> [!NOTE]
>
> If the vouchers come from an external system and are therefore not in WEBSALE format, add the entry `ExternalVouchers-Allow = yes` in the `<Voucher-Txt>` section of the `shop.config`.

Guide: Providing voucher entry · Reference: Voucher-Txt section

## Step 1: Restrict the voucher

When creating the voucher in the voucher generator, enter the following string in the **Kundenspezifische Features** (custom features) field at the very bottom.

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<g><t>RejectForUserAccountsWithDiscountOrDiscountList</t></g>
```

| Bracket | Meaning |
| - | - |
| `<g>…</g>` | encloses the entire function |
| `<t>…</t>` | the type, here `RejectForUserAccountsWithDiscountOrDiscountList` |

> [!WARNING]
>
> The type name is long and is checked for an exact match. A typo is not reported; the function then simply stays off, and discounted customers redeem the voucher. Copy the name instead of typing it.

> [!NOTE]
>
> This function has no further settings. It is either set or not.

## Step 2: Add the error message

If the shop rejects the voucher because of a stored discount, it uses reason **25**. Add this reason wherever you have integrated the voucher entry, i.e. on the basket page `ws_basket.htm` or the order overview page `ws_place_order.htm`.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{MSG-Voucher_error(25)}
   Dieser Gutschein ist nicht mit Ihrem Kundenrabatt kombinierbar.<br>
   Ihr hinterlegter Rabatt wird bei dieser Bestellung selbstverständlich berücksichtigt.
{/MSG-Voucher_error(25)}
```

> [!NOTE]
>
> The second sentence is worthwhile. Without it, the customer only reads a rejection and overlooks the fact that they still receive their permanent discount. With it, the refusal becomes an explanation.

Reference: MSG-Voucher\_error

## Step 3: Point out the restriction (optional)

If the data of a voucher is available, its restriction can be displayed.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{VOUCHER-SpecialFeatures_RejectForUserAccountsWithDiscountOrDiscountList}
   Dieser Gutschein gilt nicht für Kunden mit hinterlegtem Kundenrabatt.
{/VOUCHER-SpecialFeatures_RejectForUserAccountsWithDiscountOrDiscountList}
```

> [!NOTE]
>
> The section refers to the currently loaded voucher data, i.e. to an entered voucher or to one you have loaded with `VOUCHER-LoadData`.

Reference: VOUCHER-SpecialFeatures\_RejectForUserAccountsWithDiscountOrDiscountList · VOUCHER-LoadData

## Related topics

* Guide: Offering vouchers: Overview
* Guide: Creating or importing vouchers
* Guide: Providing voucher entry


## Related topics

- [VOUCHER- (Voucher)](https://dokumentation.websale.de/en/v8s/referenz/tags/voucher-gutschein.md)
- [Percentage vouchers](https://dokumentation.websale.de/en/v8s/gutscheine-anbieten/prozentuale-gutscheine.md)
- [MSG- (Messages)](https://dokumentation.websale.de/en/v8s/referenz/tags/msg-meldungen.md)
- [Alternative product data](https://dokumentation.websale.de/en/v8s/produkte/alternative-produktdaten.md)
- [API reference vouchers](https://dokumentation.websale.de/en/schnittstellen/admin-interface-api/api-referenz-gutscheine.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.