Skip to content

Get the signed-in shopper's cart

GET
/stores/{storeRef}/cart
curl --request GET \
--url https://apibase.ecomweb.app/api/v1/stores/example/cart \
--header 'Authorization: Bearer <token>' \
--header 'x-storefront-api-key: <x-storefront-api-key>'

Returns the cart of the signed-in shopper with each line priced and the promotions that apply to it. Use these routes when the shopper is signed in, so the cart follows their account across devices; use the guest cart routes for a visitor who is not signed in. The response is 200 with an empty body when the shopper has no cart yet.

storeRef
required
string

The store’s ref, as returned by GET /stores.

The cart. The body is empty when the shopper has no cart yet.

Media typeapplication/json
object
items
required

The cart’s lines.

Array<object>
object
variant_options

The variant’s options. Empty for a line without a variant.

Array<object>
object
optionName
required

The option name, such as Color.

string
optionValue
required

The chosen value, such as Red.

string
promotions

Promotions that apply to the line.

Array<object>
object
id
required

Promotion ID.

number
name
required

Promotion name.

string
description

Promotion description, when it has one.

string
mode
required

How the promotion is triggered, such as automatic or code.

string
code

The discount code, for a code promotion.

string
type
required

Kind of promotion.

string
condition_type
required

What the promotion’s condition is based on, such as the product or the order amount.

string
discount_method

How the discount is calculated, such as a percentage or a fixed amount.

string
discount_value

The discount value; its unit follows discount_method.

number
fixed_price

The fixed price the line is sold at, for a fixed-price promotion.

number
min_amount

Minimum order amount the promotion needs.

number
min_quantity

Minimum quantity the promotion needs.

number
start_at
required

When the promotion starts, as an ISO 8601 timestamp.

string
end_at

When the promotion ends, as an ISO 8601 timestamp. Absent when it does not end.

string
best_promotion

The promotion that gives the best price, when one applies.

object
id
required

Promotion ID.

number
name
required

Promotion name.

string
description

Promotion description, when it has one.

string
mode
required

How the promotion is triggered, such as automatic or code.

string
code

The discount code, for a code promotion.

string
type
required

Kind of promotion.

string
condition_type
required

What the promotion’s condition is based on, such as the product or the order amount.

string
discount_method

How the discount is calculated, such as a percentage or a fixed amount.

string
discount_value

The discount value; its unit follows discount_method.

number
fixed_price

The fixed price the line is sold at, for a fixed-price promotion.

number
min_amount

Minimum order amount the promotion needs.

number
min_quantity

Minimum quantity the promotion needs.

number
start_at
required

When the promotion starts, as an ISO 8601 timestamp.

string
end_at

When the promotion ends, as an ISO 8601 timestamp. Absent when it does not end.

string
promotion_price
required

The unit price with this promotion applied.

number
original_price
required

The unit price before the promotion.

number
discount_amount
required

The discount this promotion gives on the line.

number
id
required

Cart line ID. Use it to update or remove the line.

string
cart_id
required

ID of the cart the line belongs to.

string
product_id
required

ID of the product.

number
variant_id

ID of the variant, or null when the line has none.

number
nullable
quantity
required

Units in the line.

number
created_at
required

When the line was added, as an ISO 8601 timestamp.

string
updated_at
required

When the line last changed, as an ISO 8601 timestamp.

string
product_name
required

Product name. Empty when the product can no longer be read.

string
product_image

URL of the product’s first image. Empty when it has none.

string
price
required

Unit price after promotions. It is 0 when the product’s price cannot be read.

number
original_price

Unit price before promotions.

number
variant_name

The variant’s label, such as M - Red. Empty for a line without a variant.

string
id
required

Cart ID.

string
user_id

ID of the signed-in shopper who owns the cart, or null for a guest cart.

string
nullable
session_id

The guest session ID that owns the cart, or null once a shopper owns it.

string
nullable
status
required

Cart status: ACTIVE, ABANDONED or CONVERTED.

string
expires_at

When the cart expires, as an ISO 8601 timestamp, or null when it does not.

string
nullable
created_at
required

When the cart was created, as an ISO 8601 timestamp.

string
updated_at
required

When the cart last changed, as an ISO 8601 timestamp.

string
subtotal
required

Sum of the line totals after promotions.

number
original_subtotal
required

Sum of the line totals before promotions.

number
discount_amount
required

Total discount from promotions.

number
shipping_fee
required

Shipping fee. It is always 0 here; shipping is priced at checkout.

number
total
required

Amount due: the subtotal after promotions.

number
item_count
required

Total units across all lines.

number

Example generated

{
"items": [
{
"variant_options": [
{
"optionName": "example",
"optionValue": "example"
}
],
"promotions": [
{
"id": 1,
"name": "example",
"description": "example",
"mode": "example",
"code": "example",
"type": "example",
"condition_type": "example",
"discount_method": "example",
"discount_value": 1,
"fixed_price": 1,
"min_amount": 1,
"min_quantity": 1,
"start_at": "example",
"end_at": "example"
}
],
"best_promotion": {
"id": 1,
"name": "example",
"description": "example",
"mode": "example",
"code": "example",
"type": "example",
"condition_type": "example",
"discount_method": "example",
"discount_value": 1,
"fixed_price": 1,
"min_amount": 1,
"min_quantity": 1,
"start_at": "example",
"end_at": "example",
"promotion_price": 1,
"original_price": 1,
"discount_amount": 1
},
"id": "example",
"cart_id": "example",
"product_id": 1,
"variant_id": 1,
"quantity": 1,
"created_at": "example",
"updated_at": "example",
"product_name": "example",
"product_image": "example",
"price": 1,
"original_price": 1,
"variant_name": "example"
}
],
"id": "example",
"user_id": "example",
"session_id": "example",
"status": "example",
"expires_at": "example",
"created_at": "example",
"updated_at": "example",
"subtotal": 1,
"original_subtotal": 1,
"discount_amount": 1,
"shipping_fee": 1,
"total": 1,
"item_count": 1
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}