Spaces:
Sleeping
Sleeping
File size: 701 Bytes
06b3f12 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
cart = [] # Store all cart items
def add_to_cart(dish_name, spice_level, extras, instructions, quantity, menu_data):
"""Add selected item with options to the cart."""
dish = menu_data[menu_data['Dish Name'] == dish_name].iloc[0]
price = dish['Price']
extras_cost = sum([float(extra.split('+ $')[-1]) for extra in extras]) if extras else 0
total_price = (price + extras_cost) * quantity
# Add to cart
cart.append({
"Dish": dish_name,
"Spice Level": spice_level,
"Extras": ", ".join(extras) if extras else "None",
"Instructions": instructions,
"Quantity": quantity,
"Price": f"${total_price:.2f}"
})
return cart
|