Create a Coffee Ordering App in Python

Build a Coffee Ordering App in Python in 2 minutes! Add orders, view cart, checkout, and get a thank-you message. Perfect mini project for beginners.

☕ Create a Coffee Ordering App in Python – Beginner Project with Source Code

Coffee ordering app in Python tutorial

Have you ever wanted to build something fun but practical with Python? Something you could actually use? A coffee ordering app is perfect. It’s simple enough to finish in a few minutes, but it teaches you core concepts like dictionaries, loops, functions, and user input handling. Plus, you can extend it into a real‑world application later.

In this tutorial, we’ll build a console-based coffee ordering app that lets users browse a menu, add items to a cart, view the cart with totals, and checkout. No external libraries — just pure Python. By the end, you’ll have a working mini‑project you can show off or customize for your own coffee shop.

If you're just starting with Python, check out our complete Python beginner’s guide first.


✨ What You’ll Learn

  • Using dictionaries to store menu items and prices
  • Building functions to organize code (show_menu, add_to_cart, view_cart, checkout)
  • Working with loops (while) to keep the app running until exit
  • Managing a shopping cart with quantities using cart.get()
  • Calculating totals and displaying formatted output
  • Basic input validation (checking if item exists, positive quantities)

These are the same patterns used in real e‑commerce apps, restaurant ordering systems, and even inventory management software. Master them here, and you’ll be ready for larger projects.


📱 Real‑World Use Cases

This simple app mimics what you see in:

  • Cafe kiosk ordering systems (touchscreen menus)
  • Food delivery apps like Zomato or Swiggy (simplified cart logic)
  • Point of Sale (POS) systems for small businesses
  • Inventory tracking where each item has a price and quantity

Once you understand this, you can add a database (SQLite) or a GUI (Tkinter) to turn it into a real desktop application.


💻 Full Source Code (Copy, Paste & Run)

print("☕ Welcome to Python Coffee Shop ☕")

menu = {
    "Espresso": 50,
    "Latte": 70,
    "Cappuccino": 80,
    "Mocha": 90,
    "Black Coffee": 40
}

cart = {}

def show_menu():
    print("\nMenu:")
    for item, price in menu.items():
        print(f"  {item}: ₹{price}")

def add_to_cart():
    show_menu()
    choice = input("\nEnter coffee name: ").title()
    if choice in menu:
        qty = int(input("Enter quantity: "))
        if qty > 0:
            cart[choice] = cart.get(choice, 0) + qty
            print(f"✅ {qty} {choice}(s) added to cart.")
        else:
            print("❌ Quantity must be positive.")
    else:
        print("❌ Sorry, that’s not on the menu.")

def view_cart():
    if not cart:
        print("\n🛒 Cart is empty.")
    else:
        print("\n🛒 Your Cart:")
        total = 0
        for item, qty in cart.items():
            price = menu[item] * qty
            total += price
            print(f"  {item} x {qty} = ₹{price}")
        print(f"Total Amount: ₹{total}")

def checkout():
    if not cart:
        print("\n🛒 Cart is empty. Add something first!")
        return
    view_cart()
    print("\n💳 Checking out...")
    print("Thank you for ordering from Python Coffee Shop! ☕❤️")

while True:
    print("\n1️⃣ Add Order  2️⃣ View Cart  3️⃣ Checkout  4️⃣ Exit")
    choice = input("Select an option: ")
    if choice == '1':
        add_to_cart()
    elif choice == '2':
        view_cart()
    elif choice == '3':
        checkout()
        break
    elif choice == '4':
        print("👋 See you soon at Python Coffee Shop!")
        break
    else:
        print("❌ Invalid option, try again.")

⚙️ How It Works – Step by Step

1. The Menu Dictionary

menu = {"Espresso": 50, "Latte": 70, ...} stores coffee names as keys and prices as values. This makes it easy to add or remove items later.

2. The Cart Dictionary

cart = {} will store the user's selected items and quantities. For example, after ordering 2 Lattes, cart becomes {"Latte": 2}.

3. Functions for Each Action

  • show_menu() – loops through the menu and prints each item.
  • add_to_cart() – asks for coffee name and quantity, validates, and updates the cart using cart.get(choice, 0) + qty (which adds to existing quantity if already in cart).
  • view_cart() – calculates total price for each line item and overall total.
  • checkout() – displays the cart again and thanks the user, then breaks the loop.

4. Main Loop

The while True loop shows the menu options repeatedly until the user checks out or exits. This is the same pattern used in most console applications.

For another project using similar concepts (dictionaries and loops), try our drinks ordering app.


🖥️ Sample Output

☕ Welcome to Python Coffee Shop ☕

1️⃣ Add Order  2️⃣ View Cart  3️⃣ Checkout  4️⃣ Exit
Select an option: 1

Menu:
  Espresso: ₹50
  Latte: ₹70
  Cappuccino: ₹80
  Mocha: ₹90
  Black Coffee: ₹40

Enter coffee name: Latte
Enter quantity: 2
✅ 2 Latte(s) added to cart.

1️⃣ Add Order  2️⃣ View Cart  3️⃣ Checkout  4️⃣ Exit
Select an option: 2

🛒 Your Cart:
  Latte x 2 = ₹140
Total Amount: ₹140

1️⃣ Add Order  2️⃣ View Cart  3️⃣ Checkout  4️⃣ Exit
Select an option: 3

🛒 Your Cart:
  Latte x 2 = ₹140
Total Amount: ₹140

💳 Checking out...
Thank you for ordering from Python Coffee Shop! ☕❤️

🚀 How to Extend This Project (Real-World Ideas)

  • Add more items: Include teas, snacks, or pastries by extending the menu dictionary.
  • Remove items from cart: Add a function to reduce quantity or delete an item.
  • Apply discounts: Add a loyalty points system or weekday discounts.
  • Save orders to a file: Use json to store the day's sales for reporting.
  • GUI version: Rebuild using Tkinter or PyQt for a desktop app.
  • Web version: Use Flask or Django to turn it into a web ordering system.

If you're interested in building a payment system to go with this coffee shop, check out our simple payment app tutorial.


❓ Frequently Asked Questions (FAQ)

1. Can I run this coffee ordering app on my phone?

Yes! Use Pydroid 3 (Android) or Pythonista (iOS). The code is pure Python and works in any terminal environment.

2. How do I add a new coffee type?

Simply edit the menu dictionary. For example, add "Cold Coffee": 60. No other changes needed — the functions automatically pick it up.

3. Why does it crash when I enter a letter for quantity?

Because int(input()) expects a number. To fix, use a try-except block to handle non‑numeric input. We left it simple for beginners, but adding error handling is a great improvement.

4. Can I use this code for a school project?

Absolutely. Many teachers ask for a “restaurant ordering system” as a beginner project. Add comments and a brief report explaining the code structure.

5. How do I save the cart so it doesn't reset when the program closes?

You would need to write the cart dictionary to a file using json.dump() and load it at startup. That's an intermediate topic — start with our data recovery article to understand file basics.


📺 Video Tutorial (Watch & Code Along)

👉 Full article and code: DomeBytes Coffee App Page


🔗 Related Posts You Might Like


🏁 Final Thoughts

You’ve just built a coffee ordering app in Python — a complete, functional mini‑project. It may be simple, but it teaches you real programming patterns: dictionaries for data, functions for organization, loops for repetition, and user input handling. Every professional developer started with projects just like this.

Now take it further: add error handling, a graphical interface, or save orders to a file. The skills you learn here will apply directly to larger systems. Keep coding, and don’t forget to subscribe to DomeBytes on YouTube for more Python tutorials and project ideas.

Author: Amal | Website: DomeBytes.com

About the author

AMAL AJI
Web wizard

Post a Comment

💡 Got a question or feedback about this post? Drop your comment below! We review all messages before publishing to keep the discussion clean and useful.