Paddle.Checkout.updateItems()
Updates the list of items for an open checkout.
Use Paddle.Checkout.updateItems()
to dynamically update the items list for an open checkout.
Typically used with inline checkout to update quantities or add addons to the checkout.
To use this method, a checkout should already be opened. Use the Paddle.Checkout.open()
method to open a checkout.
Pass an array of objects, where each object contains a priceId
and quantity
property. priceId
should be a Paddle ID of a price entity.
Recurring items on a checkout must have the same billing interval. For example, you can't have a checkout with some prices that are billed monthly and some products that are billed annually.
Paddle expects the complete list of items that you want to be on the checkout — including existing items. If you don't include an existing item, it's removed from the checkout. To learn more, see Work with lists
Use the
Paddle.Checkout.updateCheckout()
method to update discount and customer information, as well as items. You might do this when you need to swap or remove a discount when updating items.
Parameters
List of items for this checkout.
Paddle ID of the price for this item.
Quantity for this line item.
Example
This example passes an array called itemsList
to Paddle.Checkout.updateItems()
.
If successful, the items on the opened checkout are updated.
123456789101112131415161var itemsList = [
2 {
3 priceId: 'pri_01gm81eqze2vmmvhpjg13bfeqg',
4 quantity: 1
5 },
6 {
7 priceId: 'pri_01gm82kny0ad1tk358gxmsq87m',
8 quantity: 1
9 },
10 {
11 priceId: 'pri_01gm82v81g69n9hdb0v9sw6j40',
12 quantity: 1
13 }
14];
15
16Paddle.Checkout.updateItems(itemsList);
To learn more, see Pass or update checkout items
Events
checkout.items.updated | Emitted when the checkout items list is updated. |
checkout.items.removed | Emitted when an item is removed from the checkout. |