Add to basket
add_to_basketUse this when someone asks to add teas.co.uk products to their basket. It adds to what is already there: a product already in the basket goes up by the quantity given. items takes up to 20 products, each an id from find_products with a quantity of 1 to 99. An id teas.co.uk does not know fails the whole call with an error naming it, and nothing is added; a product that cannot be added (out of stock, or over the 20 kg parcel limit) is listed in messages while the rest are added. Returns the basket with the live subtotal and a delivery estimate. Nothing is bought or charged. Leave basket_id out on hosts that identify the customer; otherwise pass the basket_id from the first basket result to every later basket tool. Not for changing or removing a line (use update_basket); to buy chosen products straight away use checkout_session.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Products and quantities to add. | |
| basket_id | No | Only for hosts that do not identify the user: the basket_id returned by an earlier basket tool in this conversation. Leave it out otherwise. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| added | No | How many products were added. | |
| items | Yes | Number of items in the basket. | |
| lines | Yes | ||
| delivery | Yes | ||
| messages | Yes | Anything that could not be added or changed, in plain words. | |
| subtotal | No | Pounds including VAT, before delivery. | |
| basket_id | No | Present only when the host did not identify the user: pass it to later basket tools. | |
| subtotal_text | Yes |