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
              • POSTCreate Cart
              • GETGet Cart
              • PUTUpdate Customer ID
              • DELDelete Cart
        • 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
RESTAdminManagementCartsCarts Single

Update Customer ID

PUT
https://api.bigcommerce.com/stores/:store_hash/v3/carts/:cartId
PUT
/stores/:store_hash/v3/carts/:cartId
$curl -X PUT https://api.bigcommerce.com/stores/store_hash/v3/carts/cartId \
> -H "Accept: application/json" \
> -H "X-Auth-Token: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "customer_id": 12345,
> "version": 3
>}'
1{
2 "data": {
3 "id": "a3f1c9e2-4b7d-4f8a-9c2e-1d2f3b4a5c6d",
4 "customer_id": 12345,
5 "channel_id": 1,
6 "email": "jane.doe@example.com",
7 "currency": {
8 "code": "usd"
9 },
10 "tax_included": true,
11 "base_amount": 150.75,
12 "discount_amount": 15,
13 "manual_discount_amount": 5,
14 "cart_amount": 130.75,
15 "coupons": [
16 {
17 "code": "SUMMER21",
18 "id": "coup123",
19 "coupon_type": "1",
20 "discounted_amount": 10,
21 "display_name": "10% Off Summer Sale"
22 }
23 ],
24 "discounts": [
25 {
26 "id": "coupon",
27 "discounted_amount": 10
28 }
29 ],
30 "line_items": {
31 "physical_items": [
32 {
33 "variant_id": 358,
34 "product_id": 12,
35 "quantity": 3,
36 "id": "6e193ce6-f327-4dcc-b75e-72cf6738525e",
37 "parent_id": "b1a2c3d4-e5f6-7890-abcd-ef1234567890",
38 "sku": "SMGREEN",
39 "name": "Classic Green T-Shirt",
40 "url": "http://your-store-url.mybigcommerce.com/classic-green-tshirt/",
41 "taxable": true,
42 "image_url": "https://your-store-url.com/images/products/classic-green-tshirt.png",
43 "discounts": [
44 {
45 "id": "disc123",
46 "discounted_amount": 4
47 }
48 ],
49 "coupons": 1,
50 "discount_amount": 4,
51 "coupon_amount": 2,
52 "original_price": 25,
53 "list_price": 20,
54 "sale_price": 18,
55 "extended_list_price": 60,
56 "extended_sale_price": 54,
57 "is_require_shipping": true,
58 "is_mutable": true,
59 "added_by_promotion": false,
60 "gift_wrapping": {
61 "name": "Birthday Wrap",
62 "message": "Happy Birthday!",
63 "amount": 1.99
64 }
65 }
66 ],
67 "digital_items": [
68 {
69 "id": "d4f5e6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
70 "parent_id": "",
71 "variant_id": 459,
72 "product_id": 34,
73 "sku": "EBOOK123",
74 "name": "E-Book: Learn API Design",
75 "url": "http://your-store-url.mybigcommerce.com/ebook-learn-api-design/",
76 "quantity": 1,
77 "taxable": false,
78 "image_url": "https://your-store-url.com/images/products/ebook-learn-api-design.png",
79 "discounts": [
80 {
81 "id": "disc456",
82 "discounted_amount": 1.5
83 }
84 ],
85 "coupons": 0,
86 "discount_amount": 1,
87 "coupon_amount": 0,
88 "original_price": 15,
89 "list_price": 15,
90 "sale_price": 13.5,
91 "extended_list_price": 15,
92 "extended_sale_price": 13.5,
93 "is_require_shipping": false,
94 "is_mutable": true,
95 "added_by_promotion": false,
96 "download_file_urls": [
97 "https://your-store-url.com/downloads/ebook-learn-api-design.pdf"
98 ],
99 "download_page_url": "https://your-store-url.com/downloads/ebook-learn-api-design",
100 "download_size": "5MB"
101 }
102 ],
103 "gift_certificates": [
104 {
105 "id": "giftcert123",
106 "name": "Holiday Gift Certificate",
107 "theme": "Christmas",
108 "amount": 50,
109 "taxable": false,
110 "sender": {
111 "name": "John Smith",
112 "email": "john.smith@example.com"
113 },
114 "recipient": {
115 "name": "Jane Doe",
116 "email": "jane.doe@example.com"
117 },
118 "message": "Happy Holidays!"
119 }
120 ],
121 "custom_items": [
122 {
123 "id": "customitem789",
124 "sku": "CUSTOM001",
125 "name": "Custom Engraved Plaque",
126 "quantity": "2",
127 "list_price": "45.00",
128 "extended_list_price": 90,
129 "image_url": "https://your-store-url.com/images/products/custom-engraved-plaque.png"
130 }
131 ]
132 },
133 "created_time": "2024-06-01T10:15:30Z",
134 "updated_time": "2024-06-10T14:20:00Z",
135 "locale": "en-US",
136 "promotions": {
137 "banners": {
138 "id": "promo789",
139 "type": "banner",
140 "page": [
141 "cart",
142 "checkout"
143 ],
144 "text": "Save 10% on your next purchase with code SAVE10"
145 }
146 },
147 "version": 3
148 },
149 "meta": {}
150}
Updates a *Cartʼs* `customer_id`. **Notes** Changing the *Cart* `customer_id` will remove any promotions or shipping calculations on the *Cart*. These are tied to the customer depending on cart conditions and any customer groups. 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

Get Cart

Next

Delete Cart

Built with

Updates a Cartʼs customer_id.

Notes

Changing the Cart customer_id will remove any promotions or shipping calculations on the Cart. These are tied to the customer depending on cart conditions and any customer groups.

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.
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.
customer_idintegerOptional
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.