---
title: "Multilingual Coupon Messages With the [alg_wc_cbur_translate] Shortcode"
description: "Show the WooCommerce Coupon is not valid message in the visitor's language with the [alg_wc_cbur_translate] shortcode."
url: "https://wpfactory.com/docs/role-based-discounts/"
updated: "2026-10-05"
category: Shortcodes
tags:
  - "Coupon & Discount by User Role for WooCommerce"
---

# Multilingual Coupon Messages With the [alg_wc_cbur_translate] Shortcode

## Translate the coupon message with a shortcode

[Coupon by User Role for WooCommerce](https://wpfactory.com/item/coupon-by-user-role-for-woocommerce/) includes one shortcode, `[alg_wc_cbur_translate]`, for showing the "Coupon is not valid" message in the visitor's language. It works inside the message field because that field runs shortcodes.

### Where to use it

Go to **WPFactory > Coupon by User Role** (also reachable at **WooCommerce > Settings > Coupon by User Role**), open the **Availability** section, and put the shortcode in the **"Coupon is not valid" message** field.

### Requirements

The shortcode reads the active language from the WPML constant `ICL_LANGUAGE_CODE`. It works on WPML, and on Polylang setups that define this constant. If neither is active, the shortcode simply falls back to its default text, so it is safe to leave in place on a single-language store.

### Two ways to write it

#### 1. Inline attributes

Pass the language, the text for that language, and the fallback text as attributes:

```
[alg_wc_cbur_translate lang="DE" lang_text="Gutschein ist fuer deine Benutzerrolle nicht gueltig." not_lang_text="Coupon is not valid for your user role."]
```

- `lang`: one or more language codes, comma separated (for example `DE` or `DE,NL`).
- `lang_text`: shown when the active language matches `lang`.
- `not_lang_text`: shown for every other language.

#### 2. Enclosing tags

Wrap each language's text between opening and closing tags, and use `not_lang` for the fallback:

```
[alg_wc_cbur_translate lang="DE"]Gutschein ist fuer deine Benutzerrolle nicht gueltig.[/alg_wc_cbur_translate]
[alg_wc_cbur_translate lang="NL"]Coupon is niet geldig voor jouw gebruikersrol.[/alg_wc_cbur_translate]
[alg_wc_cbur_translate not_lang="DE,NL"]Coupon is not valid for your user role.[/alg_wc_cbur_translate]
```

- `lang="DE"`: the wrapped text shows only when the active language is DE.
- `not_lang="DE,NL"`: the wrapped text shows for every language except DE and NL.

### Attributes reference

| Attribute | Purpose |
| --- | --- |
| `lang` | Language code(s) this text is for. Comma separate for several. |
| `not_lang` | Show for every language except the listed one(s). |
| `lang_text` | Inline form only: text shown when `lang` matches. |
| `not_lang_text` | Inline form only: fallback text for other languages. |

### Combine with message placeholders

The message field also supports `%coupon_code%` and `%coupon_amount%`, so you can mix placeholders and translation in one message. See [customizing the "Coupon is not valid" message](https://wpfactory.com/docs/customize-coupon-not-valid-message/).

### Need a hand?

Our team answers every ticket on the [Coupon by User Role support forum](https://wpfactory.com/support/item/coupon-by-user-role-for-woocommerce/).

Related articles

- [Coupons by User Role: How to Reset a Settings Section](https://wpfactory.com/docs/reset-coupon-settings-section/)
- [Disable or Invalidate Coupons for Guests and Logged-Out Visitors](https://wpfactory.com/docs/guest-role-coupons/)
- [Coupons by User Role: Developer Hooks and Filters Reference](https://wpfactory.com/docs/coupon-by-user-role-hooks-filters/)
- [Coupon Role Rules Not Working: Fixes](https://wpfactory.com/docs/coupon-role-discounts-fix/)
- [Free vs Pro: Coupon by User Role for WooCommerce](https://wpfactory.com/docs/free-vs-pro/)

 

[![Coupon & Discount by User Role for WooCommerce](https://wpfactory.com/wp-content/uploads/Coupon-by-User-Role-for-WooCommerce.webp)](https://wpfactory.com/item/coupon-by-user-role-for-woocommerce/)
