> For the complete documentation index, see [llms.txt](https://developer.paddle.com/llms.txt).

# Prevent customers from removing a discount at checkout

Use a parameter or HTML data attribute when working with Paddle.js to hide the option to remove an applied discount at checkout.

---

## What's new?

We added a new parameter to the [`Paddle.Checkout.open()`](https://developer.paddle.com/paddlejs/methods/paddle-checkout-open.md) method and [`Paddle.Initialize()`](https://developer.paddle.com/paddlejs/methods/paddle-initialize.md) methods that you can use to prevent customers from removing an applied discount at checkout when working with [Paddle.js](https://developer.paddle.com/paddlejs/overview.md):

- **settings** (object): Set general checkout settings.
  - **allowDiscountRemoval** (boolean or null): Whether the user can remove an applied discount at checkout. Defaults to `true`

We also added a corresponding [HTML data attribute](https://developer.paddle.com/paddlejs/html-data-attributes.md):

- **data-allow-discount-removal** (boolean): Whether the user can remove an applied discount at checkout. Defaults to `true`.. Default: `true`

## How it works

[Discounts](https://developer.paddle.com/build/products/offer-discounts-promotions-coupons.md) let you reduce the amount that a customer has to pay by a percentage (e.g. -10%) or fixed amount (e.g. -$10) for an item, transaction, or subscription. You can set discounts up so that customers can apply them at checkout using a code, or[automatically apply them by passing them to Paddle.js](https://developer.paddle.com/build/checkout/prefill-checkout-properties#pass-discount.md) when opening a checkout.

When a discount is applied, Paddle Checkout includes an option to let customers remove an applied discount.

The new `allowDiscountRemoval` settings parameter and `data-allow-discount-removal` HTML data attribute let you prevent customers from removing an applied discount at checkout. When `false`, the message showing that a discount has been applied does not include the button to remove the discount.

### When true (default)

When `true` (or if omitted), customers may remove the applied discount using the cross icon.

### When false

When `false`, the applied discount is presented to the customer but they can't remove it.

You can pass settings for opened checkouts using either [`Paddle.Checkout.open()`](https://developer.paddle.com/paddlejs/methods/paddle-checkout-open.md) or [`Paddle.Initialize()`](https://developer.paddle.com/paddlejs/methods/paddle-initialize.md). Settings passed to `Paddle.Initialize()` are default settings, applied to all checkouts opened on a page.

{% callout type="note" %}
This change removes the option for customers to remove a discount themselves, but you can still use the [`Paddle.Checkout.updateCheckout()`](https://developer.paddle.com/paddlejs/methods/paddle-checkout-updatecheckout.md) method to remove a discount programmatically.
{% /callout %}

## Examples

{% accordion %}
{% accordion-item title="Paddle.Checkout.open()" %}

This example includes the `settings` object as part of the checkout open method. `allowDiscountRemoval` is set to `false`, meaning the option to remove an applied discount is hidden.

The settings passed here only apply to the opened checkout.

<!-- Example showing showAddTaxId being passed to Paddle.Checkout.open() -->
```javascript {% title="New showAddTaxId parameter" highlightLines="[18]" %}
var itemsList = [
  {
    priceId: 'pri_01gm81eqze2vmmvhpjg13bfeqg',
    quantity: 1
  },
  {
    priceId: 'pri_01gm82kny0ad1tk358gxmsq87m',
    quantity: 1
  }
];

Paddle.Checkout.open({
  settings: {
    displayMode: "overlay",
    theme: "light",
    locale: "en",
    discountCode: "CHECKOUTDEMO",
    allowDiscountRemoval: false
  },
  items: itemsList,
});
```

{% /accordion-item %}
{% accordion-item title="Paddle.Initialize()" %}

This example sets default checkout settings for all checkouts opened on a page. `allowDiscountRemoval` is set to `false`, meaning the option to remove an applied discount is hidden.

<!-- Example showing allowDiscountRemoval being passed to Paddle.Initialize() -->
```javascript {% title="New allowDiscountRemoval parameter" highlightLines="[9]" %}
Paddle.Initialize({
  token: 'live_7d279f61a3499fed520f7cd8c08',
  checkout: {
    settings: {
      displayMode: "overlay",
      theme: "light",
      locale: "en",
      discountCode: "CHECKOUTDEMO",
      allowDiscountRemoval: false
    }
  }
});
```

{% /accordion-item %}
{% /accordion %}

## Next steps

This change is live in Paddle.js now, so you can start using `allowDiscountRemoval` or `data-allow-discount-removal` when you're ready.

You don't need to do anything to get the latest version of Paddle.js — we serve the latest version automatically.
## Summary of changes

| Name | Type | Change | Entity | Description |
| --- | --- | --- | --- | --- |
| `allowDiscountRemoval` | Paddle.js param | added | Paddle.Checkout.open() | Show a remove button next to applied discounts. |
| `data-allow-discount-removal` | Paddle.js param | added | HTML data attributes |  |
