Get Cart by Session ID

Endpoint: GET /carts/{session_id}

Purpose

This endpoint retrieves the current state of a cart associated with a specific session ID. It includes cart items, totals, shipping info, product details, discounts, and coupon messages (if any).

Path Parameters

Field
Type
Description
session_id
string
The unique session identifier for the cart

Query Parameters

This endpoint does not require any query parameters

Use Case

Used to fetch and display the active cart session, including items added, pricing breakdowns, and applied discounts. It enables frontend updates, checkout previews, or cart restoration for returning users.

Request Body

This endpoint does not require a request body.

Response

The response includes a comprehensive cart object, which provides customer information, session ID, currency, shipping totals, items in cart, and any messages related to discount validation. This is essential for displaying the current cart content and status before proceeding to checkout.

GET
https://{your_site_domain}/api/v4/carts/{session_id}
Try It Out
{
    "cart": {
        "customer_id": CUSTOMER_ID,
        "session_id": "SESSION_ID",
        "currency_code": "CURRENCY_CODE",
        "currency_symbol": "CURRENCY_SYMBOL",
        "delivery_type": "DELIVERY_TYPE",
        "totals": {
            "subtotal": SUBTOTAL,
            "discount": DISCOUNT,
            "shipping_discount": SHIPPING_DISCOUNT,
            "tax": TAX,
            "total": TOTAL,
            "grand_total": GRAND_TOTAL,
            "paid": PAID_AMOUNT
        },
        "shipping": {
            "cost": SHIPPING_COST,
            "handling_fee": HANDLING_FEE,
            "handling_tax": HANDLING_TAX,
            "shipping_tax": SHIPPING_TAX,
            "total_tax": TOTAL_SHIPPING_TAX
        },
        "items": [
            {
                "id": CART_ITEM_ID,
                "quantity": QUANTITY,
                "variations": [
                    "VARIATION_LABEL_1",
                    "VARIATION_LABEL_2"
                ],
                "taxable": IS_TAXABLE,
                "shippable": IS_SHIPPABLE,
                "pricing": {
                    "unit_price": UNIT_PRICE,
                    "display_unit_price": DISPLAY_UNIT_PRICE,
                    "total": ITEM_TOTAL,
                    "discount": ITEM_DISCOUNT,
                    "discount_tax": ITEM_DISCOUNT_TAX,
                    "tax": ITEM_TAX
                },
                "product": {
                    "id": PRODUCT_ID,
                    "sku": "PRODUCT_SKU",
                    "base_price": BASE_PRICE,
                    "available_stock": STOCK,
                    "on_sale": IS_ON_SALE,
                    "cost_price": COST_PRICE,
                    "sale_price": SALE_PRICE,
                    "url": "PRODUCT_URL",
                    "name": "PRODUCT_NAME",
                    "product_type": "PRODUCT_TYPE",
                    "image_link": "PRODUCT_IMAGE_LINK"
                }
            }
        ],
        "discount": {
            "discount": DISCOUNT_AMOUNT,
            "order_discount": ORDER_DISCOUNT,
            "shipping_discount": SHIPPING_DISCOUNT,
            "discount_on_tax": TAX_DISCOUNT,
            "discount_on_shipping_tax": SHIPPING_TAX_DISCOUNT
        },
        "messages": {
            "discount": {
                "message": "DISCOUNT_MESSAGE",
                "status": "DISCOUNT_STATUS"
            }
        }
    }
}