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
              • POSTAdd Cart Line Items
              • PUTUpdate Cart Line Item
              • DELDelete Cart Line Item
        • 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
RESTAdminManagementCartsItems

Update Cart Line Item

PUT
https://api.bigcommerce.com/stores/:store_hash/v3/carts/:cartId/items/:itemId
PUT
/stores/:store_hash/v3/carts/:cartId/items/:itemId
$curl -X PUT https://api.bigcommerce.com/stores/store_hash/v3/carts/cartId/items/itemId \
> -H "Accept: application/json" \
> -H "X-Auth-Token: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{}'
1{
2 "data": {
3 "id": "string",
4 "customer_id": 1,
5 "channel_id": 1,
6 "email": "string",
7 "currency": {
8 "code": "usd"
9 },
10 "tax_included": true,
11 "base_amount": 1.1,
12 "discount_amount": 1.1,
13 "manual_discount_amount": 1.1,
14 "cart_amount": 1.1,
15 "coupons": [
16 {
17 "code": "string",
18 "id": "string",
19 "coupon_type": "0",
20 "discounted_amount": 1.1,
21 "display_name": "20% Off"
22 }
23 ],
24 "discounts": [
25 {
26 "id": "coupon",
27 "discounted_amount": 1.1
28 }
29 ],
30 "line_items": {
31 "physical_items": [
32 {
33 "variant_id": 358,
34 "product_id": 12,
35 "quantity": 5,
36 "id": "6e193ce6-f327-4dcc-b75e-72cf6738525e",
37 "parent_id": "string",
38 "sku": "SMGREEN",
39 "name": "T-Shirt",
40 "url": "http://your-store-url.mybigcommerce.com/your-product/",
41 "taxable": false,
42 "image_url": "https://pathtoproductimage/ProductDefault.png",
43 "discounts": [
44 {
45 "id": "string",
46 "discounted_amount": 1.1
47 }
48 ],
49 "coupons": 1.1,
50 "discount_amount": 4,
51 "coupon_amount": 1.1,
52 "original_price": 1.1,
53 "list_price": 1.1,
54 "sale_price": 1.1,
55 "extended_list_price": 1.1,
56 "extended_sale_price": 1.1,
57 "is_require_shipping": false,
58 "is_mutable": true,
59 "added_by_promotion": false,
60 "gift_wrapping": {
61 "name": "Gift Wrap 1",
62 "message": "Happy Birthday!",
63 "amount": 1.99
64 }
65 }
66 ],
67 "digital_items": [
68 {
69 "id": "6e193ce6-f327-4dcc-b75e-72cf6738525e",
70 "parent_id": "string",
71 "variant_id": 358,
72 "product_id": 12,
73 "sku": "SMGREEN",
74 "name": "T-Shirt",
75 "url": "http://your-store-url.mybigcommerce.com/your-product/",
76 "quantity": 5,
77 "taxable": false,
78 "image_url": "https://pathtoproductimage/ProductDefault.png",
79 "discounts": [
80 {
81 "id": "string",
82 "discounted_amount": 1.1
83 }
84 ],
85 "coupons": 1.1,
86 "discount_amount": 4,
87 "coupon_amount": 1.1,
88 "original_price": 1.1,
89 "list_price": 1.1,
90 "sale_price": 1.1,
91 "extended_list_price": 1.1,
92 "extended_sale_price": 1.1,
93 "is_require_shipping": false,
94 "is_mutable": true,
95 "added_by_promotion": false,
96 "download_file_urls": [
97 "string"
98 ],
99 "download_page_url": "string",
100 "download_size": "string"
101 }
102 ],
103 "gift_certificates": [
104 {
105 "id": "string",
106 "name": "string",
107 "theme": "string",
108 "amount": 1.1,
109 "taxable": true,
110 "sender": {
111 "name": "string",
112 "email": "string"
113 },
114 "recipient": {
115 "name": "string",
116 "email": "string"
117 },
118 "message": "string"
119 }
120 ],
121 "custom_items": [
122 {
123 "id": "string",
124 "sku": "string",
125 "name": "string",
126 "quantity": "string",
127 "list_price": "string",
128 "extended_list_price": 1.1,
129 "image_url": "https://pathtoproductimage/ProductDefault.png"
130 }
131 ]
132 },
133 "created_time": "string",
134 "updated_time": "string",
135 "locale": "string",
136 "promotions": {
137 "banners": {
138 "id": "string",
139 "type": "string",
140 "page": [
141 "string"
142 ],
143 "text": "string"
144 }
145 },
146 "version": 1
147 },
148 "meta": {}
149}
Updates an existing, single line item in the *Cart*. **Notes** Currently, only updating `list_price` and `quantity` are supported. By default, overriding a product's list_price makes it ineligible for V3 product-level promotions. In **Store Settings** under **Promotions and Coupons** in the control panel, you can change this behavior to allow promotions on overridden prices. If the product has modifiers, omit the `variant_id` and instead use the `option_selections` array to describe both the **variant** and the **modifier** selections. If a variant needs to be changed or updated, the product will need to be removed and re-added to the cart with the correct variants using the **Add Cart Line Items** endpoint. `custom_items` cannot be updated via the API at this time. To update your cart, add a new updated custom item and delete the outdated one. If your cart contains only one line item, perform the add operation before the delete operation. Deleting all line items from the cart will invalidate the cart. To prevent lost updates due to concurrent requests overriding changes made by others, it is recommended to enable optimistic concurrency control by including the `version` field in the request payload. If the provided version does not match the version on the server, a conflict error will be returned, which the client can handle accordingly.
Was this page helpful?
Previous

Add Cart Line Items

Next

Delete Cart Line Item

Built with

Updates an existing, single line item in the Cart.

Notes

Currently, only updating list_price and quantity are supported. By default, overriding a product’s list_price makes it ineligible for V3 product-level promotions. In Store Settings under Promotions and Coupons in the control panel, you can change this behavior to allow promotions on overridden prices.

If the product has modifiers, omit the variant_id and instead use the option_selections array to describe both the variant and the modifier selections.

If a variant needs to be changed or updated, the product will need to be removed and re-added to the cart with the correct variants using the Add Cart Line Items endpoint.

custom_items cannot be updated via the API at this time. To update your cart, add a new updated custom item and delete the outdated one. If your cart contains only one line item, perform the add operation before the delete operation.

Deleting all line items from the cart will invalidate the cart.

To prevent lost updates due to concurrent requests overriding changes made by others, it is recommended to enable optimistic concurrency control by including the version field in the request payload. If the provided version does not match the version on the server, a conflict error will be returned, which the client can handle accordingly.

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

cartIdstringRequiredformat: "UUID"
The identifier of a specific cart.
itemIdstringRequiredformat: "number"
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.

Query parameters

includelist of enumsOptional
* `redirect_urls`: Create a direct link to a cart. This can be used for the /POST request for carts. * `line_items.physical_items.options`: The cart returns an abbreviated result. Use this to return physical items product options. To return the extended cart object, use in a /POST request. * `line_items.digital_items.options`: The cart returns an abbreviated result. Use this to return digital items product options. To return the extended cart object, use in a /POST request. * `promotions.banners`: Returns a list of eligible banners.
Allowed values:

Request

This endpoint expects an object.
line_itemobjectOptional
gift_certificateslist of objectsOptional
custom_itemslist of objectsOptional
versionintegerOptional

The cart version that you expect to apply the updates. If the provided version doesn’t match the current cart version, you will receive a conflict error. This field is optional; if not provided, optimistic concurrency control will not apply.

Response

dataobject

A cart contains a collection of items, prices, discounts, etc. It does not contain customer-related data.

metaobject
Response metadata.

Errors

409
Conflict 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.

  • redirect_urls: Create a direct link to a cart. This can be used for the /POST request for carts.
  • line_items.physical_items.options: The cart returns an abbreviated result. Use this to return physical items product options. To return the extended cart object, use in a /POST request.
  • line_items.digital_items.options: The cart returns an abbreviated result. Use this to return digital items product options. To return the extended cart object, use in a /POST request.
  • promotions.banners: Returns a list of eligible banners.