Skip to main content

Get Cart Items

GET 

https://useast.api.elasticpath.com/v2/carts/:cartID/items

Use this endpoint to retrieve cart items. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs.

You can use this endpoint to retrieve the breakdown of cart items by promotion ID. For example, if you have Promotions Standard item discount with code sale2024, Rule Promotions item discount with code sale2024, and Rule Promotions cart discount with code sale2024, the discounts.constituents field in the response example will show the breakdown of the same promotion code used in both Promotions Standard and Rule Promotions.

"data": [
{
"id": "98de010d-dd10-4fa5-a070-0b9bcdc72974",
"type": "cart_item",
"product_id": "5a4662d2-9a2b-4f6e-a215-2970db914b0c",
"name": "sku1",
"description": "sku1",
"sku": "sku1",
"slug": "sku1",
"image": {
"mime_type": "",
"file_name": "",
"href": ""
},
"quantity": 1,
"manage_stock": false,
"unit_price": {
"amount": 10000,
"currency": "USD",
"includes_tax": false
},
"value": {
"amount": 10000,
"currency": "USD",
"includes_tax": false
},
"discounts": [
{
"amount": {
"amount": -2000,
"currency": "USD",
"includes_tax": false
},
"code": "sale2024",
"id": "e4d929d5-f471-4317-9a86-a84a6c572b44",
"promotion_source": "rule-promotion",
"is_cart_discount": true
},
{
"amount": {
"amount": -1000,
"currency": "USD",
"includes_tax": false
},
"code": "sale2024",
"id": "de19a043-a6da-4bde-b896-d17e16b77e25",
"promotion_source": "rule-promotion"
},
{
"amount": {
"amount": -1000,
"currency": "USD",
"includes_tax": false
},
"code": "sale2024",
"id": "509295ee-2971-45b6-801e-95df09756989"
},
{
"amount": {
"amount": -1000,
"currency": "USD",
"includes_tax": false
},
"code": "sale2024",
"id": "ca79e606-7ecd-41ac-9478-af4c8c28c546",
"promotion_source": "rule-promotion",
"is_cart_discount": true
}
],
"links": {
"product": "https://useast.api.elasticpath.com/v2/products/5a4662d2-9a2b-4f6e-a215-2970db914b0c"
},
"meta": {
"display_price": {
"with_tax": {
"unit": {
"amount": 5000,
"currency": "USD",
"formatted": "$50.00"
},
"value": {
"amount": 5000,
"currency": "USD",
"formatted": "$50.00"
}
},
"without_tax": {
"unit": {
"amount": 5000,
"currency": "USD",
"formatted": "$50.00"
},
"value": {
"amount": 5000,
"currency": "USD",
"formatted": "$50.00"
}
},
"tax": {
"unit": {
"amount": 0,
"currency": "USD",
"formatted": "$0.00"
},
"value": {
"amount": 0,
"currency": "USD",
"formatted": "$0.00"
}
},
"discount": {
"unit": {
"amount": -5000,
"currency": "USD",
"formatted": "-$50.00"
},
"value": {
"amount": -5000,
"currency": "USD",
"formatted": "-$50.00"
}
},
"without_discount": {
"unit": {
"amount": 10000,
"currency": "USD",
"formatted": "$100.00"
},
"value": {
"amount": 10000,
"currency": "USD",
"formatted": "$100.00"
}
},
"discounts": {
"sale2024": {
"amount": -5000,
"currency": "USD",
"formatted": "-$50.00",
"constituents": {
"509295ee-2971-45b6-801e-95df09756989": {
"amount": -1000,
"currency": "USD",
"formatted": "-$10.00"
},
"ca79e606-7ecd-41ac-9478-af4c8c28c546": {
"amount": -1000,
"currency": "USD",
"formatted": "-$10.00"
},
"de19a043-a6da-4bde-b896-d17e16b77e25": {
"amount": -1000,
"currency": "USD",
"formatted": "-$10.00"
},
"e4d929d5-f471-4317-9a86-a84a6c572b44": {
"amount": -2000,
"currency": "USD",
"formatted": "-$20.00"
}
}
}
}
},
"timestamps": {
"created_at": "2024-05-24T18:00:58Z",
"updated_at": "2024-05-24T18:00:58Z"
}
},
"catalog_id": "09b9359f-897f-407f-89a2-702e167fe781",
"catalog_source": "pim"
}

Request

Path Parameters

    cartID stringrequired

    The unique identifier of the cart that you created.

Responses

Response Headers
    Schema
      data object[]
    • Array [
    • anyOf
      typestringrequired

      The type of object being returned.

      Possible values: [cart_item]

      quantitynumberrequired

      The number of items added to the cart.

      idstring<uuid>

      Specifies the ID of the product you want to add to cart. (use this OR sku)

      skustring

      Specifies the item SKU that you want to add to cart. (use this OR id)

      custom_inputsobject

      The custom text to be added to a product.

      bundle_configuration object

      Object used to describe the bundle options selected.

      selected_optionsobject

      Specifies selected options.

      component_productsarray

      Array of component products for the selected options.

      shipping_group_idstring

      Identifier for a created Cart Shipping Group

      locationstring

      The slug of a stock location.

      product_idstring<uuid>

      The unique ID of the product.

      subscription_offering_idstring<uuid>

      The unique ID of the subscription offering for subscription items.

      namestring

      The name of this item

      descriptionstring

      A description of the cart item.

      catalog_idstring<uuid>

      The unique identifier of the catalog associated with the product is shown if catalog_source=pim is set.

      catalog_sourcestring

      The catalog source. Always pim or legacy.

      image object
      mime_typestring

      The MIME type for the uploaded file.

      file_namestring

      The name of the image file that was uploaded.

      hrefstring

      The link to the image.

      manage_stockboolean

      Whether or not the quantity of the item will be checked against inventory.

      unit_price object

      The unit price of the item.

      amountnumber

      The amount for this item as an integer.

      currencystring

      The currency this item was added to the cart as.

      includes_taxboolean

      Whether or not this price is tax inclusive.

      value object

      The total price of the item (i.e., unit * quantity).

      amountnumber

      The amount for this item as an integer.

      currencystring

      The currency this item was added to the cart as.

      includes_taxboolean

      Whether or not this price is tax inclusive.

      links object
      productstring

      A URL related to the resource.

      meta object
      display_price object
      with_tax object

      The amount of this item after discounts and taxes are applied.

      unit object

      The amount per each single unit.

      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      value object

      The total amount of the item (i.e., unit * quantity).

      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      without_tax object

      The amount of this item after discounts are applied and before taxes.

      unit object

      The amount per each single unit.

      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      value object

      The total amount of the item (i.e., unit * quantity).

      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      tax object

      The amount of taxes applied to this item.

      unit object

      The amount per each single unit.

      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      value object

      The total amount of the item (i.e., unit * quantity).

      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      discount object

      The amount of the discount applied to this item.

      unit object

      The amount per each single unit.

      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      value object

      The total amount of the item (i.e., unit * quantity).

      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      without_discount object
      unit object

      The amount per each single unit.

      amountnumber

      The raw total.

      currencystring

      The currency set for this amount.

      formattedstring

      The formatted total based on the amount and currency.

      value object

      The total amount of the item (i.e., unit * quantity).

      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.

      Example: 2023-11-07T23:04:18.845Z
      updated_at

      The date this was last updated.

      Example: 2023-11-07T23:04:18.845Z
    • ]

    Authorization: http

    name: bearerAuthtype: httpscheme: bearer
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Get, "https://useast.api.elasticpath.com/v2/carts/:cartID/items");
    request.Headers.Add("Accept", "application/json");
    request.Headers.Add("Authorization", "Bearer <token>");
    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
    ResponseClear

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