Add to basket
add_to_basketUse this when someone asks to add teas.co.uk products to their basket. Each quantity is added to what is already there, so a product already in the basket goes up by that amount. Ids come from find_products. If any id is unknown, the call fails, names that id and adds nothing. 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. 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 every time. To change or remove 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. | |
| idempotency_key | No | Optional. A unique key for this change (8 to 128 letters, digits or . _ : -). Sending the same key again within 24 hours returns the first answer instead of making the change twice. |
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 |