> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://mailchimp.com/developer/marketing/api/ecommerce/update-store-cart/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mailchimp.com/_mcp/server. # Update cart PATCH https://api.mailchimp.com/3.0/ecommerce/stores/{store_id}/carts/{cart_id} Content-Type: application/json Update a specific cart. Reference: https://mailchimp.com/developer/marketing/api/ecommerce/update-store-cart ## Authentication - `Authorization` header (bearer token, required) — Authorization using a Mailchimp API key (a.k.a. Bearer token) - `Authorization` header (bearer token, required) — Authorization using OAuth ## Request ### Path parameters - `store_id` (string, required) — The store id. - `cart_id` (string, required) — The id for the cart. ### Body (application/json) This endpoint expects an object. - `campaign_id` (string, optional) — A string that uniquely identifies the campaign associated with a cart. - `checkout_url` (string, optional) — The URL for the cart. This parameter is required for [Abandoned Cart](https://mailchimp.com/help/create-a-classic-abandoned-cart-email/) automations. - `currency_code` (string, optional) — The three-letter ISO 4217 code for the currency that the cart uses. - `customer` (EcommerceStoresCartsPatch, optional) — Information about a specific customer. Orders for existing customers should include only the `id` parameter in the `customer` object body. - `id` (30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaId, optional) — A unique identifier for the cart. - `lines` (list of 30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaLinesItems, optional) — An array of the cart's line items. - `order_total` (30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaOrderTotal, optional) - `tax_total` (30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaTaxTotal, optional) ## Response ### 200 - `_links` (list of ECommerceCartLinksItems, optional) — A list of link types and descriptions for the API schema documents. - `campaign_id` (string, optional) — A string that uniquely identifies the campaign associated with a cart. - `checkout_url` (string, optional) — The URL for the cart. This parameter is required for [Abandoned Cart](https://mailchimp.com/help/create-a-classic-abandoned-cart-email/) automations. - `created_at` (datetime, optional) — The date and time the cart was created in ISO 8601 format. - `currency_code` (string, optional) — The three-letter ISO 4217 code for the currency that the cart uses. - `customer` (ECommerceCustomer, optional) — Information about a specific customer. - `id` (string, optional) — A unique identifier for the cart. - `lines` (list of ECommerceCartLineItem, optional) — An array of the cart's line items. - `order_total` (double, optional) — The order total for the cart. - `tax_total` (double, optional) — The total tax for the cart. - `updated_at` (datetime, optional) — The date and time the cart was last updated in ISO 8601 format. ## Types ### EcommerceStoresCartsPatch Information about a specific customer. Orders for existing customers should include only the `id` parameter in the `customer` object body. - `id` (string, optional) — A unique identifier for the customer. Limited to 50 characters. - `address` (EcommerceStoresCartsPatchAddress, optional) — The customer's address. - `company` (string, optional) — The customer's company. - `first_name` (string, optional) — The customer's first name. - `last_name` (string, optional) — The customer's last name. - `opt_in_status` (boolean, optional) — The customer's opt-in status. This value will never overwrite the opt-in status of a pre-existing Mailchimp list member, but will apply to list members that are added through the e-commerce API endpoints. Customers who don't opt in to your Mailchimp list [will be added as `Transactional` members](https://mailchimp.com/developer/marketing/docs/e-commerce/#customers). - `total_spent` (EcommerceStoresCartsPatchTotalSpent, optional) ### 30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaId A unique identifier for the cart. ### 30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaLinesItems Information about a specific cart line item. - `price` (30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaLinesItemsPrice, optional) - `product_id` (string, optional) — A unique identifier for the product associated with the cart line item. - `product_variant_id` (string, optional) — A unique identifier for the product variant associated with the cart line item. - `quantity` (integer, optional) — The quantity of a cart line item. ### 30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaOrderTotal ### 30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaTaxTotal ### ECommerceCartLinksItems This object represents a link from the resource where it is found to another resource or action that may be performed. - `href` (string, optional) — This property contains a fully-qualified URL that can be called to retrieve the linked resource or perform the linked action. - `method` (enum, optional) — The HTTP method that should be used when accessing the URL defined in 'href'. - Allowed values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `HEAD` - `rel` (string, optional) — As with an HTML 'rel' attribute, this describes the type of link. - `schema` (string, optional) — For HTTP methods that can receive bodies (POST and PUT), this is a URL representing the schema that the body should conform to. - `targetSchema` (string, optional) — For GETs, this is a URL representing the schema that the response should conform to. ### ECommerceCustomer Information about a specific customer. - `_links` (list of ECommerceCustomerLinksItems, optional) — A list of link types and descriptions for the API schema documents. - `address` (ECommerceCustomerAddress, optional) — The customer's address. - `company` (string, optional) — The customer's company. - `created_at` (datetime, optional) — The date and time the customer was created in ISO 8601 format. - `email_address` (string, optional) — The customer's email address. - `first_name` (string, optional) — The customer's first name. - `id` (string, optional) — A unique identifier for the customer. - `last_name` (string, optional) — The customer's last name. - `opt_in_status` (boolean, optional) — The customer's opt-in status. This value will never overwrite the opt-in status of a pre-existing Mailchimp list member, but will apply to list members that are added through the e-commerce API endpoints. Customers who don't opt in to your Mailchimp list [will be added as `Transactional` members](https://mailchimp.com/developer/marketing/docs/e-commerce/#customers). - `orders_count` (integer, optional) — The customer's total order count. - `sms_phone_number` (string, optional) — A US phone number for SMS contact. - `total_spent` (ECommerceCustomerTotalSpent, optional) - `updated_at` (datetime, optional) — The date and time the customer was last updated in ISO 8601 format. ### ECommerceCartLineItem Information about a specific cart line item. - `_links` (list of ECommerceCartLineItemLinksItems, optional) — A list of link types and descriptions for the API schema documents. - `id` (string, optional) — A unique identifier for the cart line item. - `price` (double, optional) — The price of a cart line item. - `product_id` (string, optional) — A unique identifier for the product associated with the cart line item. - `product_title` (string, optional) — The name of the product for the cart line item. - `product_variant_id` (string, optional) — A unique identifier for the product variant associated with the cart line item. - `product_variant_title` (string, optional) — The name of the product variant for the cart line item. - `quantity` (integer, optional) — The quantity of a cart line item. ### EcommerceStoresCartsPatchAddress The customer's address. - `address1` (string, optional) — The mailing address of the customer. - `address2` (string, optional) — An additional field for the customer's mailing address. - `city` (string, optional) — The city the customer is located in. - `country` (string, optional) — The customer's country. - `country_code` (string, optional) — The two-letter code for the customer's country. - `postal_code` (string, optional) — The customer's postal or zip code. - `province` (string, optional) — The customer's state name or normalized province. - `province_code` (string, optional) — The two-letter code for the customer's province or state. ### EcommerceStoresCartsPatchTotalSpent ### 30EcommerceStoresStoreIdCartsCartIdPatchRequestBodyContentApplicationJsonSchemaLinesItemsPrice ### ECommerceCustomerLinksItems This object represents a link from the resource where it is found to another resource or action that may be performed. - `href` (string, optional) — This property contains a fully-qualified URL that can be called to retrieve the linked resource or perform the linked action. - `method` (enum, optional) — The HTTP method that should be used when accessing the URL defined in 'href'. - Allowed values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `HEAD` - `rel` (string, optional) — As with an HTML 'rel' attribute, this describes the type of link. - `schema` (string, optional) — For HTTP methods that can receive bodies (POST and PUT), this is a URL representing the schema that the body should conform to. - `targetSchema` (string, optional) — For GETs, this is a URL representing the schema that the response should conform to. ### ECommerceCustomerAddress The customer's address. - `address1` (string, optional) — The mailing address of the customer. - `address2` (string, optional) — An additional field for the customer's mailing address. - `city` (string, optional) — The city the customer is located in. - `country` (string, optional) — The customer's country. - `country_code` (string, optional) — The two-letter code for the customer's country. - `postal_code` (string, optional) — The customer's postal or zip code. - `province` (string, optional) — The customer's state name or normalized province. - `province_code` (string, optional) — The two-letter code for the customer's province or state. ### ECommerceCustomerTotalSpent ### ECommerceCartLineItemLinksItems This object represents a link from the resource where it is found to another resource or action that may be performed. - `href` (string, optional) — This property contains a fully-qualified URL that can be called to retrieve the linked resource or perform the linked action. - `method` (enum, optional) — The HTTP method that should be used when accessing the URL defined in 'href'. - Allowed values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `HEAD` - `rel` (string, optional) — As with an HTML 'rel' attribute, this describes the type of link. - `schema` (string, optional) — For HTTP methods that can receive bodies (POST and PUT), this is a URL representing the schema that the body should conform to. - `targetSchema` (string, optional) — For GETs, this is a URL representing the schema that the response should conform to. ## Examples **Request** ```json {} ``` **Response** ```json { "_links": [ { "href": "string", "method": "GET", "rel": "string", "schema": "string", "targetSchema": "string" } ], "campaign_id": "839488a60b", "checkout_url": "string", "created_at": "2015-07-15T19:28:00+00:00", "currency_code": "string", "customer": { "_links": [ { "href": "string", "method": "GET", "rel": "string", "schema": "string", "targetSchema": "string" } ], "address": { "address1": "675 Ponce de Leon Ave NE", "address2": "Suite 5000", "city": "Atlanta", "country": "United States", "country_code": "US", "postal_code": "30308", "province": "Georgia", "province_code": "GA" }, "company": "string", "created_at": "2015-07-15T19:28:00+00:00", "email_address": "string", "first_name": "string", "id": "string", "last_name": "string", "opt_in_status": true, "orders_count": 4, "sms_phone_number": "string", "total_spent": 1.1, "updated_at": "2015-07-15T19:28:00+00:00" }, "id": "string", "lines": [ { "_links": [ { "href": "string", "method": "GET", "rel": "string", "schema": "string", "targetSchema": "string" } ], "id": "string", "price": 1.1, "product_id": "string", "product_title": "string", "product_variant_id": "string", "product_variant_title": "string", "quantity": 1 } ], "order_total": 1.1, "tax_total": 1.1, "updated_at": "2015-07-15T19:28:00+00:00" } ``` **SDK Code** ```python import requests url = "https://api.mailchimp.com/3.0/ecommerce/stores/store_id/carts/cart_id" payload = {} headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.mailchimp.com/3.0/ecommerce/stores/store_id/carts/cart_id'; const options = { method: 'PATCH', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.mailchimp.com/3.0/ecommerce/stores/store_id/carts/cart_id" payload := strings.NewReader("{}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.mailchimp.com/3.0/ecommerce/stores/store_id/carts/cart_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://api.mailchimp.com/3.0/ecommerce/stores/store_id/carts/cart_id") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('PATCH', 'https://api.mailchimp.com/3.0/ecommerce/stores/store_id/carts/cart_id', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.mailchimp.com/3.0/ecommerce/stores/store_id/carts/cart_id"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.mailchimp.com/3.0/ecommerce/stores/store_id/carts/cart_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` > Find all the Mailchimp API documentation and tools developers need to send marketing and transactional emails.