LogoLogo
Build appsContact API support
Storefronts
  • Build apps
  • Site Templates
  • API Reference
  • Changelog
Storefronts
  • Ecwid storefronts overview
  • Get started
    • Storefront customization options
    • Quickstart: customize storefront with Ecwid JS API
  • Track Storefront events
    • "Page is loaded" events
    • "Customer logged in" event
    • "Cart details are changed" event
    • "New order is placed" event
    • "Instant Site section load" events
  • Get Storefront details
    • Get Ecwid store ID
    • Get storefront language and currency
    • Get visitor location
    • Get public app details
  • Manage customers on the storefront
    • Get logged in customer's details
    • Manage customer's cookie consent
    • Log out customer
  • Open page on the storefront
    • Overview of open page options
    • Open product pages with params
    • Open category pages with params
    • Open search page with params
    • Open account pages with params
  • Manage cart and checkout
    • Get cart details
    • Add product to the cart
    • Remove product from the cart
    • Fully clear the cart
    • Create pre-filled shopping carts
    • Calculate cart details
    • Send customer to the checkout
    • Set customer's email for the checkout
    • Set customer's comments for order
    • Set customer's shipping and billing addresses
    • Set custom order referer
  • Store configuration settings
    • Overview
    • Behavioral configs
    • Design configs

Lightspeed® 2025

On this page

Was this helpful?

  1. Manage cart and checkout

Get cart details

Last updated 1 month ago

Was this helpful?

Ecwid.Cart.get()

This method allows you to receive full information about the current shopping cart. The response is available in the cart .

Example of JS call and response
Ecwid.Cart.get(function(cart){
  console.log(JSON.stringify(cart));
});

/* prints

{
    "id": "TJ6VG",
    "cartId": "99E7E224-5F6F-4C00-BFE9-9F72F2B5A471",
    "orderId": 506524300,
    "items": [
        {
            "quantity": 2,
            "product": {
                "id": 455570501,
                "sku": "0000077",
                "price": 500,
                "name": "Pizza #2",
                "weight": 1,
                "shortDescription": "",
                "url": "https://example.company.site/products/Example-product-p455570501",
                "variation": 2343242
            },
            "options": {}
        },
        {
            "quantity": 4,
            "product": {
                "id": 439710255,
                "sku": "000001",
                "price": 500,
                "name": "Pizza",
                "weight": 0.5,
                "shortDescription": "",
                "url": "https://example.company.site/products/Example-product-2-p439710255"
            },
            "options": {
                "Size": "L, R",
                "Print_number": "123"
            }
        }
    ],
    "productsQuantity": 6,
    "shippingMethod": "Pickup",
    "shippingPerson": {
        "countryCode": "GE",
        "countryName": "Georgia",
        "name": "Jhn Doe",
        "phone": "16019521325",
        "stateOrProvinceCode": "TB"
    },
    "weight": 6
}

/*

cart callback fields

Field
Type
Description

cartId

string

Cart ID. Matches with the cart ID in REST API /carts endpoint.

id

string

Order ID, assigned to the cart. Remains the same when an order is placed and becomes visible to the customer and store owner in notifications and Ecwid admin.

orderId

string

Internal order ID for Ecwid services. Use id field instead.

items

Details about products in the shopping cart.

productsQuantity

number

Total quantity of products added to the shopping cart.

subtotal

number

Cart subtotal – cost of all products added to the cart without any discounts, taxes, or shipping costs applied.

total

number

Cart total – total cost of the cart with all available price modifiers applied.

isPricesIncludeTax

boolean

Defines if the order uses gross/net prices.

tax

number

Total tax applied to the cart. May include taxes to both product and shipping costs.

couponName

string

Name of the discount coupon applied to the cart. Does not contain the actual coupon code.

paymentMethod

string

Name of the payment method selected by a customer at the storefront.

paymentModule

string

Internal "module" for the payment method selected by a customer at the storefront. Only available for Ecwid-build payment methods.

weight

number

Total weight of products added to the shopping cart.

shippingMethod

string

Name of the selected shipping method. Available only when a customer goes to the checkout_payment_details page.

shippingPerson

Details about shipping address. Available only when a customer goes to the shipping_delivery page.

billingPerson

Details about customer's billing address. Has the same format with the shippingPerson. Becomes available only when a customer goes to the payment page.

items

items contains an array of objects with the details for each product added to the shopping cart.

Field
Type
Description

quantity

number

Quantity of the specific product added to the shopping cart.

product

Details about the product added to the shopping cart.

options

object options

Map of the selected product options (option name as a key and option value as a value).

Code example for options object:

"options": {  
    "Size": "M",  
    "Print_number": "9"  
}

product

Field
Type
Description

id

number

Internal product ID.

sku

string

Product SKU.

price

number

Product price before applied taxes, fees, or discounts.

isCustomerSetPrice

boolean

If true, product allows customer to set their own price for it.

selectedPrice

number

If isCustomerSetPrice is true, contains a custom price for the product that the customer entered before adding a product to the cart.

name

string

Product name.

weight

number

Product weight.

shortDescription

string

Product description truncated to 120 characters.

url

string

Link to the product page.

variation

number

If selected options match with one of product variations, this field contains the ID of product variation added to the cart.

mediaItem

Details about product media (images and video)

recurringChargeSettings

Details about subscription customer has chosen for the product. Only available for subscription products.

shippingPerson

Name
Type
Description

name

string

Customer's name.

companyName

string

Company name of a customer, if available.

street

strin

Shipping/billing address. Street.

city

string

Shipping/billing address. City.

countryName

string

Shipping/billing address. Country name.

countryCode

string

Shipping/billing address. Country code in ISO 3166-2.

postalCode

string

Shipping/billing address. ZIP code.

stateOrProvinceCode

string

Shipping/billing address. State code ISO 3166-2.

phone

string

Customer's phone number, if available.

mediaItem

Name
Type
Description

type

string

One of: PICTURE VIDEO

isMain

boolean

Defines if the image is main for the product. Products can have only one main image and multiple secondary ones referred as the "gallery".

Only for the PICTURE type.

id

string

Internal image ID.

Only for the PICTURE type.

borderInfo

Details about image border.

Only for the PICTURE type.

width

number

Image width in pixels.

Only for the PICTURE type.

height

number

Image height in pixels.

Only for the PICTURE type.

image160pxUrl

string

Link to the image resized to fit 160x160px container.

Only for the PICTURE type.

image400pxUrl

string

Link to the image resized to fit 400x400px container.

Only for the PICTURE type.

image800pxUrl

string

Link to the image resized to fit 800x800px container.

Only for the PICTURE type.

videoInfo

Details about embedded video.

Only for the VIDEO type.

videoInfo

Name
Type
Description

embedHtml

string

String with HTML code for video embedding.

url

string

Link to the video.

width

number

Width of the embedded video.

height

number

Height of the embedded video.

borderInfo

Field
Type
Description

dominatingColor

Border color in RGBa format.

homogeneity

boolean

Defines if an image is homogeneous.

dominatingColor

Field
Type
Description

isDark

number

true if the image is considered dark.

isFullyTransparent

number

true if the image is considered transparent.

rbgHexValue

number

HEX code for the calculated "medium" color of all outside pixels of the image, for example #2e3236.

recurringChargeSettings

Field
Type
Description

recurringIntervalCount

number

Index of the current recurring interval.

recurringSubscriptionInterval

string

How often subscription charges will happen. One of: DAY, WEEK, MONTH, YEAR.

signUpFee

number

Additional fee to the first payment for the subscription.

subscriptionPriceWithSignUpFee

number

Total price of the first subscription payment.

array of objects

object

object

object

object

object

object

object

object

callback
items
shippingPerson
shippingPerson
product
mediaItem
recurringChargeSettings
borderInfo
videoInfo
dominatingColor