Add to cart
add_to_cartPut one unit of a variant in a cart. Use it after get_product has given you the variant id, and keep cart.id from the answer for the next call. Returns the whole cart, or an error when the variant is unknown or out of stock.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"variant_id": "<variant_id>"
},
"name": "add_to_cart"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cart_id | No | the cart.id from an earlier add_to_cart; leave out to open a new cart | |
| variant_id | Yes | the id of the chosen variant, from get_product |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cart | No | ||
| error | No | Upstream's error string ("Error adding item to cart", ...); absent on success. |