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

# Update an open checkout using Paddle.js

Pass items, discount, and customer information to a new Paddle.js method to update an open checkout.

---

## What's new?

We added a new [`Paddle.Checkout.updateCheckout()`](https://developer.paddle.com/paddlejs/methods/paddle-checkout-updatecheckout.md) method to Paddle.js that you can use to update items, discount, and customer information for an open checkout.

To complement this, we added a new [`checkout.updated`](https://developer.paddle.com/paddlejs/general/checkout-updated.md) event that's emitted when a checkout is updated using this new method.

## How it works

You can use [`Paddle.Checkout.updateItems()`](https://developer.paddle.com/paddlejs/methods/paddle-checkout-updateitems.md) to dynamically update items on an open checkout. This method only lets you update items, so it's perfect for simpler [inline checkout implementations](https://developer.paddle.com/build/checkout/build-branded-inline-checkout.md) where you might want to add, remove, or change quantities of items on a checkout.

In more complex implementations, you might like to swap or remove a discount at the same time as changing items. For example, some discounts may be restricted to particular products or prices, so changing items on a checkout might make the discount incompatible.

The new `Paddle.Checkout.updateCheckout()` method lets you update discount and customer information, as well as updating items. You can pass `discountId` or `discountCode` along with an array of `items` to swap or remove the discount on an open checkout.

{% callout type="info" %}
The `Paddle.Checkout.updateItems()` method is not deprecated. You can use it for simpler implementations when you only need to make changes to items for an open checkout.
{% /callout %}

## Examples

This example passes an array of items and a discount code to [`Paddle.Checkout.updateCheckout()`](https://developer.paddle.com/paddlejs/methods/paddle-checkout-updatecheckout.md).

If successful, the items and the discount on the opened checkout are updated.

<!-- Example showing items and discountCode being passed to Paddle.Checkout.updateCheckout() -->
```javascript {% title="Paddle.Checkout.updateCheckout()" highlightLines="[12,13,14,15]" %}
var updatedItemsList = [
  {
    priceId: 'pri_01gm81eqze2vmmvhpjg13bfeqg',
    quantity: 10
  },
  {
    priceId: 'pri_01gm82kny0ad1tk358gxmsq87m',
    quantity: 1
  }
];

Paddle.Checkout.updateCheckout({
  items: updatedItemsList,
  discountCode: "BF20OFF"
});
```

## Next steps

This change is live in Paddle.js now, so you can start using [`Paddle.Checkout.updateCheckout()`](https://developer.paddle.com/paddlejs/methods/paddle-checkout-updatecheckout.md) 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 |
| --- | --- | --- | --- | --- |
| `Paddle.Checkout.updateCheckout` | Paddle.js method | added | Paddle.js | Use to update items, discount, and customer information for an open checkout. |
| `checkout.updated` | Paddle.js event | added | Paddle.js | Emitted when a checkout is updated using the new Paddle.Checkout.updateCheckout method. |
