Docs

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.

Product area

  • Catalog

Tooling

  • Paddle.js
  • Checkout

Released

September 28, 2023

Status

Released

What's new?

We added a new parameter to the Paddle.Checkout.open() method and Paddle.Initialize() methods that you can use to hide the option to add a discount at checkout when working with Paddle.js:

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:

data-show-add-discounts boolean
Default: true

Whether the option to add a discount is displayed at checkout. Defaults to 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() or Paddle.Initialize(). Settings passed to Paddle.Initialize() are default settings, applied to all checkouts opened on a page.

Examples

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.

New showAddDiscounts parameter
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,
});

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.

New showAddDiscounts parameter
Paddle.Initialize({
token: 'live_7d279f61a3499fed520f7cd8c08',
checkout: {
settings: {
displayMode: "overlay",
theme: "light",
locale: "en",
showAddDiscounts: "false"
}
}
});

This example shows hiding the option to add a discount passed as an HTML data attribute against a Paddle Checkout element.

It includes checkout settings and items.

New HTML data attribute
<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>

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

Entity Field Change Type
Paddle.Checkout.open() showAddDiscounts + Added Paddle.js param
Hide the add discount option at checkout.
HTML data attributes data-show-add-discounts + Added Paddle.js param

Was this page helpful?