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

# Hide the option to add a discount at checkout

Use a parameter or HTML data attribute when working with Paddle.js to hide the option to add a 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 hide the option to add a discount at checkout when working with [Paddle.js](https://developer.paddle.com/paddlejs/overview.md):

- **settings** (object): Set general checkout settings.
  - **showAddDiscounts** (boolean or null): Whether the option to add a discount is displayed at checkout. Requires the "display discount field on the checkout" option enabled in Paddle. Defaults to `true`.

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

- **data-show-add-discounts** (boolean): Whether the option to add a discount is displayed at checkout. Defaults to `true`.. Default: `true`

## How it works

Paddle Checkout includes an "Add Discount" option to let customers enter a discount code. Seeing the option to add a discount might make some customers reluctant to purchase if they don't have a code. You might also want to hide it if you don't generally offer discounts.

The new `showAddDiscounts` settings parameter and `data-show-add-discounts` HTML data attribute lets you hide the option to add a discount at checkout when working with Paddle.js.

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 apply a discount themselves, but you can still [prefill discounts](https://developer.paddle.com/build/checkout/prefill-checkout-properties.md) when opening a checkout using `discountCode` and `discountId` parameters, or `data-discount-code` and `data-discount-id` HTML data attributes.
{% /callout %}

## Examples

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

This example includes the `settings` object as part of the checkout open method. `showAddDiscounts` set to `false`, meaning the option to "Add discount" is hidden for the opened checkout.

The settings passed here only apply to the opened checkout.

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

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

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

This example sets default checkout settings for all checkouts opened on a page. `showAddDiscounts` set to `false`, meaning the option to "Add discount" is hidden for all opened checkouts on the page.

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

{% /accordion-item %}
{% accordion-item title="HTML data attributes" %}

This example shows hiding the option to add a discount passed as an [HTML data attribute](https://developer.paddle.com/paddlejs/html-data-attributes.md) against a Paddle Checkout element.

It includes checkout settings and items.

<!-- Example showing data-show-add-discounts on a checkout element -->
```html {% title="New HTML data attribute" highlightLines="[17]" %}
<a href='#' 
  class='paddle_button'
  data-display-mode='overlay'
  data-theme='light'
  data-locale='en'
  data-allow-logout='false'
  data-items='[
    {
      "priceId": "pri_01gm81eqze2vmmvhpjg13bfeqg",
      "quantity": 1
    },
    {
      "priceId": "pri_01gm82kny0ad1tk358gxmsq87m",
      "quantity": 1
    }
  ]'
  data-show-add-discounts='false'
>
  Buy now
</a>
```

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

## Next steps

This change is live in Paddle.js now, so you can start using `showAddDiscounts` or `data-show-add-discounts` 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 |
| --- | --- | --- | --- | --- |
| `showAddDiscounts` | Paddle.js param | added | Paddle.Checkout.open() | Hide the add discount option at checkout. |
| `data-show-add-discounts` | Paddle.js param | added | HTML data attributes |  |
