Skip to main content

Update a Cart

PUT 

https://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

    cartID stringrequired

    The unique identifier of a cart created by you.

Body

    descriptionstring

    The cart description.

    discount_settings object
    custom_discounts_enabledboolean

    This parameter enables custom discounts for a cart. When set to true, Elastic Path promotions will not be applied to the new carts. Default is set from cart discount settings for the store. See Cart Settings.

    use_rule_promotionsboolean

    When set to true, this parameter allows the cart to use rule promotions.

    inventory_settings object
    defer_inventory_checksboolean

    This parameter enables deferring inventory checks on the cart. This allows items to be added to or updating in the cart without checking stock levels. Inventory checks are still performed as normal on checkout

    namestring

    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
    emailemail

    The email address attached to a cart.

    snapshot_datestring

    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.

    custom_attributesobject

    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" } }
    payment_intent_idstring

    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

Response Headers
    Schema
      data object
      idstring

      The unique identifier for the cart. Use SDK or create it yourself.

      typestring

      The type of object being returned.

      namestring

      The name of this cart.

      descriptionstring

      A description of the cart.

      contact object
      emailemail

      The email address attached to a cart.

      discount_settings object
      custom_discounts_enabledboolean

      This parameter enables custom discounts for a cart. When set to true, Elastic Path promotions will not be applied to the new carts. Default is set from cart discount settings for the store. See Cart Settings.

      use_rule_promotionsboolean

      When set to true, this parameter allows the cart to use rule promotions.

      inventory_settings object
      defer_inventory_checksboolean

      This parameter enables deferring inventory checks on the cart. This allows items to be added to or updating in the cart without checking stock levels. Inventory checks are still performed as normal on checkout

      payment_intent_idstring

      Stripe-assigned unique identifier for the linked Payment Intent

      custom_attributesobject

      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" } }
      links object
      selfstring

      A link to that specific resource.

      meta object
      display_price object
      with_tax object
      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      without_tax object
      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      tax object
      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      discount object
      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      without_discount object
      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      shipping object
      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      timestamps object
      created_atstring

      The date this was created.

      updated_at

      The date this was last updated.

      relationships object
      customers object

      Array of relationships

      data object[]

      Individual relationships

    • Array [
    • typestring

      The type of related resource.

      iduuid

      The ID of the related resource.

    • ]
    • items object

      Array of relationships

      data object[]

      Individual relationships

    • Array [
    • typestring

      The type of related resource.

      iduuid

      The ID of the related resource.

    • ]
    • accounts object

      Array of relationships

      data object[]

      Individual relationships

    • Array [
    • typestring

      The type of related resource.

      iduuid

      The ID of the related resource.

    • ]
    • custom_discounts object

      Array of relationships

      data object[]

      Individual relationships

    • Array [
    • typestring

      The type of related resource.

      iduuid

      The ID of the related resource.

    • ]
    • promotions object

      Array of relationships

      data object[]

      Individual relationships

    • Array [
    • typestring

      The type of related resource.

      iduuid

      The ID of the related resource.

    • ]

    Authorization: http

    name: bearerAuthtype: httpscheme: bearer
    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());
    Request Collapse all
    Base URL
    https://useast.api.elasticpath.com
    Auth
    Parameters
    — pathrequired
    Body
    {
      "description": "string",
      "discount_settings": {
        "custom_discounts_enabled": true,
        "use_rule_promotions": true
      },
      "inventory_settings": {
        "defer_inventory_checks": true
      },
      "name": "string",
      "contact": {
        "email": "user@example.com"
      },
      "snapshot_date": "string",
      "custom_attributes": {},
      "payment_intent_id": "string"
    }
    
    ResponseClear

    Click the Send API Request button above and see the response here!

    We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.