Add an item to the cart

Adds `quantity` of a product variant to the caller's cart. The first add creates the cart, with `locale` as its language; later adds ignore `locale`. A variant already in the cart has its quantity increased, up to 999. A guest's first add returns `cartToken` once: send it in `X-Lynkow-Cart-Token` on later guest calls. The add also removes the lines that can no longer be sold and reports them in `removedLines`. Errors: 422 `OUT_OF_STOCK` past the stock on a site that refuses overselling, 422 `CART_LINES_LIMIT_REACHED` on a full cart, 404 `CART_NOT_FOUND` for a variant not for sale. > **Note:** Available only on sites with e-commerce enabled.

Required access
Send
  • Publishable keyX-Lynkow-Pk
Optional: customer session tokenSite access
POST/cart/lines
Base URLhttps://api.lynkow.com/storefront/{siteId}

Request body
required

  • quantity
    integer
    required

    Required

  • variantId
    string
    required

    Required. Product variant identifier (var_ prefixed id)

  • locale
    string

    BCP 47 locale code (e.g. "en", "fr")

Feedback

Was this page helpful?