Guides

Cart Upsell Engine

The /suggest endpoint analyzes a customer's cart and recommends complementary items from the restaurant's menu. It understands cuisine pairing, detects missing categories, and respects dietary preferences.

How it works

  1. You send the current cart items and the full restaurant menu
  2. The API identifies what's missing (no drink? no dessert? no bread with curry?)
  3. It picks suggestions that match the cart's cuisine and dietary profile
  4. Returns ranked suggestions with human-readable reasons

Integration example

Call /suggest when the user views their cart or proceeds to checkout:

import requests

API_KEY = "YOUR_KEY"
BASE = "https://embed.statode.com"
headers = {"X-API-Key": API_KEY, "Content-Type": "application/json"}

cart_items = ["Chicken Biryani", "Raita"]
restaurant_menu = [
    "Chicken Biryani", "Mutton Biryani", "Raita", "Gulab Jamun",
    "Mango Lassi", "Butter Naan", "Dal Tadka", "Masala Papad"
]

resp = requests.post(f"{BASE}/suggest", headers=headers,
    json={"cart": cart_items, "menu": restaurant_menu, "top_k": 3})
suggestions = resp.json()

for s in suggestions["suggestions"]:
    print(f"Add {s['item']}? ({s['reason']}) - {s['category']}")

Example output:

Add Mango Lassi? (No beverage in cart) - beverage
Add Butter Naan? (Complements biryani) - bread
Add Gulab Jamun? (No dessert in cart) - dessert

Categories detected

The engine identifies these meal components:

  • Main - primary dishes (biryani, curry, pizza, pasta)
  • Beverage - drinks (lassi, juice, soda, coffee)
  • Bread - accompaniments (naan, roti, garlic bread)
  • Side - complementary items (raita, salad, soup, fries)
  • Dessert - sweet courses (gulab jamun, ice cream, cake)

Dietary safety

The engine respects dietary signals in the cart:

  • If all cart items are vegetarian, only vegetarian suggestions are returned
  • Non-veg proteins (chicken, mutton, prawns) are never suggested to a veg cart
  • This uses keyword-based protein detection, so it's reliable for all common proteins

Limits

  • Cart: up to 50 items
  • Menu: up to 500 items
  • top_k: 1 to 10 (default 5)

Tips

  • Send the full restaurant menu, not a filtered subset. The engine handles filtering internally.
  • Call at checkout for best conversion. Users are already committed to ordering.
  • Display the reason field to the user. "No beverage in cart" is more persuasive than a generic "You might also like" prompt.
  • For multi-restaurant platforms, always send the menu from the same restaurant as the cart.