---
title: "Add product to cart"
method: POST
path: "/add-product-in-cart"
tags: ["Cart"]
---

# Add product to cart

`POST /add-product-in-cart`

## Request

- Base URL: `http://localhost:8000/api/shop`
- URL: `http://localhost:8000/api/shop/add-product-in-cart`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-shop-api/docs/add-product-in-cart/post.ts> (a function with typed inputs; its response is checked against the schema)

Add a product to the shopping cart with quantity and optional product options.

## Headers

- `X-STOREFRONT-KEY` string, required
- `X-Locale` string
- `X-Channel` string
- `X-Currency` string

## Request body

- object
  - `productId` integer: Product ID
  - `quantity` integer: Quantity
  - `selectedConfigurableOption` integer: Child variant product ID (configurable products)
  - `superAttribute` object: Super attribute values {attributeId: optionValue} (configurable products)
  - `qty` object: Quantities per associated product {productId: quantity} (grouped products)
  - `bundleOptions` object: Bundle options {optionId: [productIds]} (bundle products)
  - `bundleOptionQty` object: Bundle option quantities {optionId: quantity} (bundle products, optional)
  - `links` integer[]: Download link IDs (downloadable products)
  - `booking` object: Booking data - varies by booking type (appointment, default, table, rental, event)
  - `specialNote` string: Special note for table bookings
  - `isBuyNow` 0 | 1: Buy now flag (0 = add to cart, 1 = buy now)

## Response `201`

Product added to cart. Returns the full cart.

## Other responses

- `400`: Missing/invalid productId or quantity, or product not saleable.
- `422`: Validation Error

---

[API](https://skmtc.dev/bagisto/apis/bagisto-shop-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-shop-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-shop-api/revisions/f619df36bf29?raw)
