Visit Main Site
Join Partner Program
Login
     
Introduction
Authentication
Documentation
Category
GET
POST
PUT
DELETE
Products
GET
POST
PUT
DELETE
Carts
GET
POST
PATCH
DELETE
Variations
GET
POST
PUT
DELETE
Currency
GET
POST
PUT
DELETE
Tax
Tax Profile
GET
POST
PUT
DELETE
Tax Rule
GET
POST
PUT
DELETE
Tax Code
GET
POST
PUT
DELETE
Tax Zone
GET
POST
PUT
DELETE
Discount
GET
POST
PUT
DELETE
Shipping
Shipping Profile
GET
POST
PUT
DELETE
Shipping Rate
GET
POST
PUT
DELETE
Shipping Rules
GET
POST
PUT
DELETE
Customer
GET
POST
PUT
DELETE
Orders
GET
POST
PATCH
Blog
GET
POST
PUT
DELETE
Settings
GET

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
JSON
{
    "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"
            }
        }
    }
}
Terms and Conditions
Privacy Policy

© 2024 WebCommander | All Rights Reserved

contact@webcommander.com
1300 797 571

WebCommander
About Us
Features
Pricing
Compare
Partners
Contact Us
Resource
Find a Partner
Help Centre
Community
Blog
Solutions
Inventory Management
Omnichannel Sales
Ecommerce Automation
B2B Ecommerce
Headless Commerce
Website Design and Performance