SathvikGanta's picture
Update components/cart.py
58036b7 verified
raw
history blame contribute delete
560 Bytes
cart = [] # Global cart list
def add_to_cart(dish_name, spice_level, extras, instructions, quantity):
"""Add selected item to the cart."""
item = {
"Dish": dish_name,
"Spice Level": spice_level,
"Extras": ", ".join(extras) if extras else "None",
"Instructions": instructions,
"Quantity": quantity,
"Price": f"${(quantity * 10.0):.2f}" # Example price calculation
}
cart.append(item)
return cart_data()
def cart_data():
"""Return the cart as a list of dictionaries."""
return cart