---
schema_version: "1"
id: 75c566eda6ec74afc7b4c2ffa568787672f4681b0e26555105da6a58f495af99
title: "Handlebars Helper Function: assignCoupon"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/handlebars/reference/data/mcn-handlebars-reference-data-assigncoupon.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-assigncoupon.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 772529d39ed81fd0937f60573ebf165d9951a1f200b4bbcd48e3232c3548430c
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# Handlebars Helper Function: assignCoupon

Claims a coupon row from a marketing object for the current recipient. Use this helper to assign a coupon code from a coupon list.

## Availability

This helper is available in the Winter ’27 release of Marketing Cloud Next.

## Syntax

```handlebars
{{assignCoupon list="CouponCodes"}}
```

## Parameters

| Parameter | Type   | Description                                                               |
| --------- | ------ | ------------------------------------------------------------------------- |
| `list`    | String | Required. The name of the marketing object that contains the coupon rows. |

## Return Value

The function returns the claimed coupon row as an object. Use the [get](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/objects/mcn-handlebars-reference-objects-get.md) helper to retrieve values from the returned row.

For a coupon list that isn't configured to always assign a new coupon, the helper returns the coupon previously assigned to the same recipient.

If no coupon is available, the coupon list isn't valid, or the recipient doesn't have an individual ID, the function throws an exception. You can use the [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md) helper to handle an unavailable coupon.

## Usage Examples

This example assigns a coupon and renders the value in the `CouponCode` field.

```handlebars
{{#with (assignCoupon list="CouponCodes")}}
  Your coupon code is {{get this "CouponCode"}}.
{{/with}}
```

### Providing a Fallback Value

This example renders a fallback message when a coupon isn't available.

```handlebars
{{fallback (get (assignCoupon list="CouponCodes") "CouponCode") "No coupon available"}}
```

## See Also

- [claimRow](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-claimrow.md)
- [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md)
- [get](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/objects/mcn-handlebars-reference-objects-get.md)
