Add Line Item

POST/store/:storeCode/carts/:cartId/line-items
publishable key

Add a line item to a cart.

Path Parameters
storeCoderequiredstring

Store slug in the URL (first argument to every SDK store method).

cartIdrequiredstring

The cart's ID.

Query Parameters
fieldsstring

Comma-separated fields to include. Prefix with `*` to expand a relation (e.g. `id,*variants`).

Request Body

Schema

Copy
HttpTypes.StoreAddCartLineItem

Properties

variant_idrequiredstring

Product variant ID.

quantityrequirednumber

Quantity to add.

metadataRecord<string, unknown>

Custom metadata for the line item.

Response

Status

200OK

Schema

Copy
HttpTypes.StoreCartResponse

Properties

cartrequiredStoreCart

The cart with the new line item.