Skip to content

Get Cart

Retrieve the current shopping cart with all items and totals.

Endpoint

GET /api/shop/cart

Request Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key

Response Fields (200 OK)

FieldTypeDescription
idintegerCart ID
itemsarrayItems in cart
subtotaldecimalItems subtotal
taxdecimalCalculated tax amount
shippingCostdecimalShipping cost
totaldecimalGrand total
itemCountintegerTotal items in cart
couponCodestringApplied coupon code (if any)

Item Fields

FieldTypeDescription
idintegerCart item ID
productIdintegerProduct ID
productNamestringProduct name
quantityintegerItem quantity
pricedecimalUnit price
subtotaldecimalLine item total
attributesobjectProduct attributes (color, size, etc.)

Use Cases

  • Display shopping cart summary
  • Show cart contents to customer
  • Calculate cart totals
  • Display cart in sidebar/dropdown
  • Pre-checkout cart review

Released under the MIT License.