For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
    • About Our APIs
  • REST
    • Overview
      • Overview
        • Abandoned Carts
        • Carts
              • GETList Cart Metafields
              • POSTCreate Cart Metafield
              • GETGet Cart Metafield
              • PUTUpdate Cart Metafield
              • DELDelete Metafield
        • Channels
        • Checkouts
        • Currencies
        • Customer Segmentation
        • Geography
        • Infrastructure Hosting
        • Inventory
        • Orders
        • Order Operations
        • Pickup
        • Pickup Methods
        • Pickup Options
        • Pricing
        • Price Lists
        • Promotions
        • Promotion Settings
        • Redirects
        • Scripts
        • Settings
        • Shipping
        • Sites
        • Subscribers
        • System Logs
        • Tax
        • Wishlists
      • Payments
  • GraphQL
    • Overview
  • MCP
    • Overview
Dev Portal
LogoLogo
RESTAdminManagementCartsMetafields

Update Cart Metafield

PUT
https://api.bigcommerce.com/stores/:store_hash/v3/carts/:cart_id/metafields/:metafield_id
PUT
/stores/:store_hash/v3/carts/:cart_id/metafields/:metafield_id
$curl -X PUT https://api.bigcommerce.com/stores/store_hash/v3/carts/cart_id/metafields/1 \
> -H "Accept: application/json" \
> -H "X-Auth-Token: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "permission_set": "app_only",
> "namespace": "Sales Department",
> "key": "Staff Name",
> "value": "Sam"
>}'
1{
2 "data": {
3 "date_created": "2022-06-16T18:39:00+00:00",
4 "date_modified": "2022-06-16T18:39:00+00:00",
5 "description": "order",
6 "id": "string",
7 "key": "Staff Name",
8 "namespace": "Sales Department",
9 "owner_client_id": "asdfasdfasdfasdfasdfasdfasdf",
10 "permission_set": "app_only",
11 "resource_id": "0",
12 "resource_type": "cart",
13 "value": "Ronaldo"
14 },
15 "meta": {}
16}

Update a Metafield, by cart_id.

Was this page helpful?
Previous

Get Cart Metafield

Next

Delete Metafield

Built with

Authentication

X-Auth-Tokenstring
### OAuth scopes | UI Name | Permission | Parameter | |:--------|:-----------|:----------| |Carts|modify|`store_cart`| |Carts |read-only|`store_cart_read_only`| |Information & Settings | modify | `store_v2_information`| |Information & Settings | read-only| `store_v2_information`| ### Authentication header | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#api-accounts). | ### Further reading For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-fundamentals/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).

Path parameters

cart_idstringRequiredformat: "UUID"

The ID of the Cart to which the transactions belong.

metafield_idintegerRequired

The unique ID of the subject Metafield.

store_hashstringRequired
Permanent ID of the BigCommerce store.

Headers

AcceptstringRequiredDefaults to application/json
The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the response body.

Request

A Metafield object.

permission_setenumRequired

Determines the visibility and writeability of the field by other API consumers.

ValueDescription
app_onlyPrivate to the app that owns the field.
readVisible to other API consumers.
writeOpen for reading and writing by other API consumers.
read_and_sf_accessVisible to other API consumers, including on the storefront.
write_and_sf_accessOpen for reading and writing by other API consumers, including on the storefront.
Allowed values:
namespacestringRequired1-64 characters
Namespace for the metafield, for organizational purposes.
keystringRequired1-64 characters

The name of the field, for example: location_id, color.

valuestringRequired1-65535 characters

The value of the field, for example: 1, blue.

descriptionstringOptional0-255 characters
Description for the metafields.

Response

A Metafield and metadata.

dataobject
Allows app partners to write custom data to various resources in the API.
metaobject
Response metadata.

Errors

400
Bad Request Error
422
Unprocessable Entity Error

OAuth scopes

UI NamePermissionParameter
Cartsmodifystore_cart
Cartsread-onlystore_cart_read_only
Information & Settingsmodifystore_v2_information
Information & Settingsread-onlystore_v2_information

Authentication header

HeaderArgumentDescription
X-Auth-Tokenaccess_tokenFor more about API accounts that generate access_tokens, see our Guide to API Accounts.

Further reading

For example requests and more information about authenticating BigCommerce APIs, see Authentication and Example Requests.

For more about BigCommerce OAuth scopes, see our Guide to API Accounts.

For a list of API status codes, see API Status Codes.

The MIME type of the response body.