> ## 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.

# Vouchers with multiple currencies

> Assign a separate value per currency to a voucher so that it is valid in subshops with different currencies, and output the values in the template.

If you run subshops with different currencies, a voucher worth 20 euros would be worthless in the US shop. That is why a voucher can be assigned a list of currencies, each with its own values.

When the customer redeems the voucher, the currency of the subshop determines which value applies. No exchange rate is used; you define the amounts per currency yourself.

## How the shop determines the value

The shop compares the currency of the current subshop with the voucher's currency list and uses the matching entry.

> [!WARNING]
>
> If the subshop's currency is not in the list, the voucher cannot be redeemed there. The customer then receives the general message "Invalid voucher number" and does not learn that the currency is the cause. Therefore, store every currency in which the voucher should be valid, and expect inquiries in a multi-country campaign if a currency is missing.

## What can be stored per currency

| Value | Applies to |
| - | - |
| Voucher value | absolute vouchers |
| Minimum order value | all vouchers |
| Maximum redemption amount | percentage vouchers |
| Capped value for set sub-items | capped vouchers |

> [!NOTE]
>
> Percentages do not need a currency list. Ten percent is ten percent in every currency. For a percentage voucher, only the maximum redemption amount is currency-dependent.

## Remaining amounts

A voucher that has not been fully redeemed keeps its remaining amount, and this can also be used in another subshop with a different currency.

> [!WARNING]
>
> The amount already used is tracked separately for each currency. A voucher worth 50 EUR and 60 USD, of which 20 EUR have been redeemed, then still has 30 EUR **and** still the full 60 USD. Therefore, do not calculate the value of a campaign as the highest individual value, but as the sum of all stored currency values.

## Prerequisites

**The voucher generator must be activated.** If you want to use it, contact your WEBSALE representative.

> [!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`.

**Voucher entry must be integrated in the shop**, namely in every subshop in which the voucher is to be valid.

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

## Step 1: Creating the voucher

Create the voucher in the voucher generator in the online service area and select the desired currencies there. For each selected currency, enter the corresponding amounts.

## Step 2: Displaying the voucher data in the shop

The data of a voucher can be output on any shop page, for example on a campaign page, so that visitors can see what their code is worth in their currency.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{VOUCHER-LoadData(123)}
   {VOUCHER-DataExists}

      {VOUCHER-MultiCurrency_CurrenciesData}
         Gültige Währungen: ~VOUCHER-MultiCurrency_CurrenciesData~
      {/VOUCHER-MultiCurrency_CurrenciesData}

      {VOUCHER-MultiCurrency_AbsoluteAmountData}
         Gutscheinwerte: ~VOUCHER-MultiCurrency_AbsoluteAmountData~
      {/VOUCHER-MultiCurrency_AbsoluteAmountData}

      {VOUCHER-MultiCurrency_AbsoluteAmountUsedData}
         Bereits eingelöst: ~VOUCHER-MultiCurrency_AbsoluteAmountUsedData~
      {/VOUCHER-MultiCurrency_AbsoluteAmountUsedData}

      {VOUCHER-MultiCurrency_MinOrderData}
         Mindestbestellwerte: ~VOUCHER-MultiCurrency_MinOrderData~
      {/VOUCHER-MultiCurrency_MinOrderData}

      {VOUCHER-MultiCurrency_MaxDiscountData}
         Maximale Einlösungsbeträge: ~VOUCHER-MultiCurrency_MaxDiscountData~
      {/VOUCHER-MultiCurrency_MaxDiscountData}

   {/VOUCHER-DataExists}
{/VOUCHER-LoadData(123)}
```

> [!NOTE]
>
> In the example, `123` stands for the voucher number. `VOUCHER-LoadData` loads the data, and `VOUCHER-DataExists` only applies if the voucher exists. Without this enclosure, empty lines appear on the page as soon as a number no longer exists.

### The output format

These five tags output their data **in technical format**, not as readable text. In addition, the output is not HTML-escaped.

| Tag | Format |
| - | - |
| `VOUCHER-MultiCurrency_CurrenciesData` | `<c>EUR</c><c>USD</c>` |
| the other four | `<g><a>10.00</a><c>EUR</c></g><g><a>20.00</a><c>USD</c></g>` |

> [!WARNING]
>
> The currency list has a different format than the four value lists. It contains only `<c>` entries, without a `<g>` enclosure and without an amount. If you process both with the same loop, you get no matches for the currency list.

> [!NOTE]
>
> Because the output is not escaped, visitors see nothing with direct output: the browser treats `<g>` and `<c>` as unknown HTML elements and hides them along with their content. Therefore, first put the value into a Design Control field and output it from there; it is then escaped and thus visible.

### Preparing the data

To prepare the data, split the list using a dynamic loop and extract the currency and amount from each entry.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{VOUCHER-MultiCurrency_AbsoluteAmountData}

   Unmaskiert: ~VOUCHER-MultiCurrency_AbsoluteAmountData~<br>
   Maskiert:   ~DC-FP1_set($VOUCHER-MultiCurrency_AbsoluteAmountData$)~~DC-FP1~

   ~DC-DynamicLoop1_setSeparatorTags(<g>,</g>)~
   ~DC-DynamicLoop1_setTaggedData($VOUCHER-MultiCurrency_AbsoluteAmountData$)~

   {@DC-DynamicLoop1}

      ~DC-FP1_set($DC-DynamicLoop1_data$)~
      ~DC-FP1_extractTaggedData(<c>,</c>)~
      ~DC-FP1~:

      ~DC-FP1_set($DC-DynamicLoop1_data$)~
      ~DC-FP1_extractTaggedData(<a>,</a>)~
      ~DC-FP1~

   {/@DC-DynamicLoop1}

{/VOUCHER-MultiCurrency_AbsoluteAmountData}
```

> [!NOTE]
>
> The order within an entry does not matter. `DC-FP1_extractTaggedData` searches by the name of the enclosing tag, not by position. You can therefore extract and output the amount and currency in any order.

> [!NOTE]
>
> The field is set again before each extraction because `DC-FP1_extractTaggedData` replaces the content of the field. Without setting it again, the second call returns nothing.

> [!NOTE]
>
> Three dynamic loops and several Design Control fields are available. If you want to show values and minimum order values side by side in a table, use two different loops, because a loop only holds one list at a time.

Reference: VOUCHER-MultiCurrency\_CurrenciesData · VOUCHER-MultiCurrency\_MinOrderData · VOUCHER-MultiCurrency\_MaxDiscountData · VOUCHER-MultiCurrency\_AbsoluteAmountData · VOUCHER-MultiCurrency\_AbsoluteAmountUsedData · DC-DynamicLoop1…3 · DC-FPX · DC-FPX\_extractTaggedData() · WS-DisableXSSProtectionOnce

## Further voucher data

Beyond the values shown here, the `VOUCHER-` tag family provides access to almost all fields that the voucher generator creates, for example the validity period, batch ID, and restrictions to products or customers.

Reference: VOUCHER-

## Related topics

* Guide: Offering vouchers: Overview
* Guide: Create or import vouchers
* Guide: Percentage vouchers


## Related topics

- [DC- (loops)](https://dokumentation.websale.de/en/v8s/referenz/tags/dc/schleifen.md)
- [VOUCHER- (Voucher)](https://dokumentation.websale.de/en/v8s/referenz/tags/voucher-gutschein.md)
- [Prices, taxes, and currency](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/preise-steuern-und-waehrung.md)
- [Redeeming multiple vouchers](https://dokumentation.websale.de/en/v8s/gutscheine-anbieten/mehrere-gutscheine-einloesen.md)
- [$wsVoucher - Vouchers](https://dokumentation.websale.de/en/frontend/referenz/module/wsvoucher.md)


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