---
title: "Update Cart Metafield"
description: "Use PUT /carts/{cart_id}/metafields/{metafield} to update a cart metafield."
canonical: https://docs.ordering.co/api-reference/guides/edit-cart-metafield/
---

# Update Cart Metafield

> **API operation:** [Open the endpoint in Scalar](https://docs.ordering.co/api-reference/#tag/carts/PUT/carts/{cart_id}/metafields/{metafield})

Use `PUT /carts/{cart_id}/metafields/{metafield}` to update a cart metafield. The operation documented here is `CartMetafield.update`.

> **Parameter:** `{metafield}` identifies the metafield to update on the selected cart.

The documented schema requires authentication, resolves the cart by UUID and user, and scopes the metafield by cart identity.

See [Cart model](https://docs.ordering.co/api-reference/guides/cart-model/) and [Extra attributes (Metafields)](https://docs.ordering.co/api-reference/guides/extra-attributes/).

## OpenAPI reference

**Operation:** `PUT /carts/{cart_id}/metafields/{metafield}`

**Path parameters**

| Name        | Type    | Required | Description |
| ----------- | ------- | -------- | ----------- |
| `cart_id`   | string  | Yes      | —           |
| `metafield` | integer | Yes      | —           |

**Header parameters**

| Name            | Type   | Required | Description |
| --------------- | ------ | -------- | ----------- |
| `X-SOCKET-ID-X` | string | No       | —           |

**Request body fields**

| Name         | Type    | Required |
| ------------ | ------- | -------- |
| `key`        | string  | No       |
| `model`      | any     | Yes      |
| `object_id`  | integer | No       |
| `user_id`    | any     | No       |
| `value`      | any     | No       |
| `value_type` | string  | No       |

**Responses**

| Code | Description                           |
| ---- | ------------------------------------- |
| 200  | OK (Envelope)                         |
| 400  | Bad Request (ErrorResponse)           |
| 401  | Unauthorized                          |
| 404  | Not Found                             |
| 429  | Too Many Requests (ErrorResponse)     |
| 500  | Internal Server Error (ErrorResponse) |
| 503  | Service Unavailable (ErrorResponse)   |

[Open this operation in the API reference](https://docs.ordering.co/api-reference/#tag/carts/PUT/carts/{cart_id}/metafields/{metafield})
