Update a Cart
PUThttps://useast.api.elasticpath.com/v2/carts/:cartID
Updates cart properties for the specified cartID.
You can update a cart to specify custom discounts. You can enable custom discounts when the discount_settings.custom_discounts_enabled
field is set to true
. Default is set from cart discount settings for the store. See Cart Settings.
You can also create a cart when inventory checks are not performed until checkout by setting the inventory_settings.defer_inventory_checks
field to true
. Again the default is set from cart discount settings for the store. See Update Cart Settings.
Request
Path Parameters
The unique identifier of a cart created by you.
- application/json
Body
The cart description.
discount_settings object
inventory_settings object
The cart name provided by the shopper. A cart name must contain 1 to 255 characters. You cannot use whitespace characters, but special characters are permitted. For more information, see the Safe Characters section.
contact object
This optional parameter sets a reference date for the cart. If this parameter is set, it allows the cart to act as one that might occur on that specified date. For example, such future carts might acquire future-enabled discounts, allowing users to test and validate future interactions with carts. The snapshot_date must be in the format 2026-02-21T15:07:25Z. By default, this parameter is left empty.
Specifies custom attributes for cart or order objects. Each attribute includes a top-level key, as well as corresponding type and value entries. Attribute values must correspond to the assigned types.
Example:
"custom_attributes": {
"is_member": {
"type": "boolean",
"value": true
},
"membership_level": {
"type": "string",
"value": "premium"
}
}
To remove the Stripe payment intent from a cart, pass the empty value in the payment_intent_id
field. You must use an empty value for this field. You cannot use this endpoint to directly update the cart to use an existing Payment Intent.
Responses
- 200
- 401
Response Headers
- application/json
- Schema
- Example (auto)
Schema
data object
{
"data": {
"id": "string",
"type": "string",
"name": "string",
"description": "string",
"contact": {
"email": "user@example.com"
},
"discount_settings": {
"custom_discounts_enabled": true,
"use_rule_promotions": true
},
"inventory_settings": {
"defer_inventory_checks": true
},
"payment_intent_id": "string",
"custom_attributes": {},
"links": {
"self": "string"
},
"meta": {
"display_price": {
"with_tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"without_tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"discount": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"without_discount": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"shipping": {
"amount": 0,
"currency": "string",
"formatted": "string"
}
},
"timestamps": {
"created_at": "string"
}
},
"relationships": {
"customers": {
"data": [
{
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
},
"items": {
"data": [
{
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
},
"accounts": {
"data": [
{
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
},
"custom_discounts": {
"data": [
{
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
},
"promotions": {
"data": [
{
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
}
}
}
}
Unauthorized
- application/json
- Schema
- Example (auto)
- Example
Schema
[
null
]
{
"errors": {
"status": 401,
"title": "Unauthorized"
}
}
Authorization: http
name: bearerAuthtype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "https://useast.api.elasticpath.com/v2/carts/:cartID");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"description\": \"string\",\n \"discount_settings\": {\n \"custom_discounts_enabled\": true,\n \"use_rule_promotions\": true\n },\n \"inventory_settings\": {\n \"defer_inventory_checks\": true\n },\n \"name\": \"string\",\n \"contact\": {\n \"email\": \"user@example.com\"\n },\n \"snapshot_date\": \"string\",\n \"custom_attributes\": {},\n \"payment_intent_id\": \"string\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());