> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# Update the cart

**Published**: 2026-11-30
**Category**: Commerce

## `PATCH /cart`

**Update the cart**

Sets the language, delivery address, shipping option and pickup point of the caller's
cart. An absent field keeps its value.

The cart keeps its shipping option only while it is active in the market of the
delivery country, else the option is cleared. A cart without a delivery country has
no shipping. A new address can change the VAT and the amounts charged.

`pickupPointId` takes an `id` from `GET /pickup-points` for the cart's option; `null`
clears it. Changing the option clears the point unless a new one is sent.

Prices and unsellable lines are updated as on `GET /cart`. Errors: 422
`SHIPPING_OPTION_NO_PICKUP_POINTS` or `PICKUP_POINT_INVALID`, 503
`PICKUP_POINT_SEARCH_UNAVAILABLE`, 422 for a malformed `shippingOptionId` or an unknown
`countryCode`. No cart, or a wrong token, returns 404 `CART_NOT_FOUND`.

> **Note:** Available only on sites with e-commerce enabled.

### Request Body

Content-Type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `locale` | string | No | BCP 47 locale code (e.g. "en", "fr") |
| `deliveryAddress` | object \| null | No | Replaces the delivery address whole; its country sets the market and VAT. Omit it to keep it, null clears it. |
| `shippingOptionId` | string \| null | No | A shipping option (prefixed `shp_`) active in the delivery country's market. Omit it to keep the choice, null clears it. |
| `pickupPointId` | string \| null | No | The `id` of a point from `GET /pickup-points` for the cart's shipping option. Omit it to keep the point, null clears it. |


### Responses

| Status | Description |
| --- | --- |
| `200` | Successful response |
| `401` | Missing or invalid storefront publishable key |
| `402` | The site subscription does not currently permit this operation |
| `403` | The storefront key origin is not allowed |
| `404` | Site, resource, or commerce feature not found |
| `422` | Validation error |
| `503` | `PICKUP_POINT_SEARCH_UNAVAILABLE`: the pickup point cannot be checked right now. Nothing is changed. |


### SDK

```typescript
import { createClient } from 'lynkow'

const lynkow = createClient({
  siteId: process.env.LYNKOW_SITE_ID!,
  publishableKey: process.env.LYNKOW_PK,
})

const cart = await lynkow.cart.setLocale('it')
console.log(cart.locale) // 'it'
```

```typescript
import { createClient } from 'lynkow'

const lynkow = createClient({
  siteId: process.env.LYNKOW_SITE_ID!,
  publishableKey: process.env.LYNKOW_PK,
})

const { data: options } = await lynkow.shippingOptions.list({ market: 'mkt_...' })
const cart = await lynkow.cart.update({
  deliveryAddress: { firstName: 'Alice', address1: '12 rue de la Paix', city: 'Paris', postalCode: '75002', countryCode: 'FR' },
  shippingOptionId: options[0]?.id ?? null,
})
if (cart.shippingOptionId === null) {
  // The choice was not kept: ask the buyer to pick again.
}
// For an option with `requiresPickupPoint`, store the point chosen from `lynkow.pickupPoints.search()`:
// await lynkow.cart.update({ pickupPointId: point.id })
```

---