Add

Adding a product to a cart will sometimes require more than just the Product ID. Depending on the specifications of the product you may need to set a specific qty or options, or even super_group or super_attribute, depending on which type of product you are adding.

For more examples of how to add different products, use the example drop-down to change the Example Request.

Query Parameters

keytypedescription
return_datastringOptional. What to return instead of true. Supported value: items, which returns the cart item IDs of the added products (see Response). A missing or unsupported value returns true.

return_data must be sent in the query string, e.g. POST /checkout2/cart_product?return_data=items. It is not read from the request body.

Product Data

keytypedescription
product_idstringint
skustringThe product to add, by SKU.
qtystringint
custom_pricestringfloat
use_discountflag (10)
unique_in_quoteflag (10)
super_attributeSuperAttributesUsed to configure a Configurable product.
super_groupSuperGroupUsed to configure a Grouped product.
bundle_optionBundleOptionsUsed to configure a Bundle's simple products.
bundle_option_qtyBundleOptionQtysUsed to configure a Bundle's simple product qty.
commentstringUsed to set a comment on the item.
optionsstringint

SuperAttributes

keytypedescription
Custom Option Idstringint

SuperGroup

keytypedescription
Grouped Product IDstringint

BundleOptions

keytypedescription
Bundle Option IDstringint

BundleOptionQtys

keytypedescription
Bundle Option IDstringint

DateOptionValue

keytypedescription
monthstringint
daystringint
yearstringint
hourstringint
minutestringint
day_partstringam or pm if your store uses AM/PM. (Required for DateTime / Time)

Response

Without return_data, a successful call returns true.

With ?return_data=items, it returns the cart and one entry per product in the request, in the same order:

{
  "cartId": 123,
  "items": [
    { "item_id": 9001, "product_id": 12, "sku": "A", "qty": 2 },
    { "item_id": 9003, "product_id": 80, "sku": "C-RED-L", "qty": 1, "variation_product_id": 84 },
    { "product_id": 70, "sku": "G", "items": [
      { "item_id": 9010, "product_id": 71, "sku": "G-1", "qty": 2 },
      { "item_id": 9011, "product_id": 72, "sku": "G-2", "qty": 1 }
    ] }
  ]
}
keytypedescription
item_idintnull
product_idintThe product added. For a configurable product, the configurable (parent) product.
skustringThe item's SKU. For a configurable product, the selected variant's SKU.
qtyfloatThe cart line's total qty after the add. If the product merged into a line already in the cart, this includes the qty that was already there.
variation_product_idintnull
itemsarrayGrouped products only: one entry per child product added, with the fields above. A grouped entry has no item_id of its own.

Notes:

  • Adding a product that is already in the cart with the same options merges into that line. Its entry returns the existing item_id and the combined qty. Send unique_in_quote: 1 to get a separate line.

  • If the same product appears twice in one request and merges, both entries return the same item_id.

  • If any product fails to add, the call returns an error and nothing is added.

  • An item_id of null means the product was added but its ID couldn't be returned. Don't retry the add; get the ID with GET /checkout2/cart_product?id=.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
products
array of objects
products
string
boolean
Response

Language
Credentials
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json