Online Shopping System Project in Python with Source Code

Online Shopping System Project in Python with Source Code

This Online Shopping System Project in Python is ideal for students who want to learn how to build a management system in Python or for online shop owners who want to handle and run all online shopping-related functions on a computer using the Python programming language.

This is why people must use this management system in order to improve their workflow and performance.

A Online Shopping System Project in Python has a user side and admin side.

The user can see the menu items, place order, cancel order and can logout.

The admin side can show the list of item, add and remove item, show total goods available, view income and loss, and can logout in the system.

To start creating a Online Shopping System Project in Python, makes sure that you have PyCharm Professional IDE Installed in your computer.

By the way if you are new to python programming and you don’t know what would be the the Python IDE to use, I have here a list of Best Python IDE for Windows, Linux, Mac OS that will suit for you.

I also have here How to Download and Install Latest Version of Python on Windows.

This Online Shopping System Project in Python also includes a Download Source Code for free, just find the downloadable source code below and click download now.

Admin Features of Online Shopping System Project in Python

  • Login and Logout – the admin need to login to access the whole system and also the admin can logout in the system.
  • Product Management – For the product, the admin can add and remove the product.
  • Manage Income – For the income, the admin can view the monthly income.
  • Available Products Management – For the available products, the admin can view the list of all available products.

User Features of Online Shopping System Project in Python

  • Login and Logout – the user need to login to access the whole system and also the user can logout in the system.
  • View Products – the user can view the available products and she or he can order the products.
  • Place Order – the user can place the order and also the user can cancel the order.

Online Shopping System Project in Python with Source Code Steps on How to Create the Project

Time needed: 5 minutes

These are the steps on how to create a Online Shopping System Project in Python with Source Code

  • Step 1: Create a Project Name.

    First, open the PyCharm IDE and click “File” and select “New Project” and then create a project name after that click the “create” button.

  • Step 2: Create a Python File.

    Next, creating a project name, “right” click the project name and the click “New” after that choose “Python File“.

    Create python file name for Online Shopping Project in Python with Source Code

  • Step 3: Name the Python File.

    Last, choose Python File name the file “main” and then click “Enter“.
    Finish creating python file name for Online Shopping Project in Python with Source Code

  • Step 4: The actual code

    Finally, you can start coding, you are free to copy the code that being provided below.

Code for the product price in Online Shopping System Project in Python

In the code given below, which is for the name, available, price and original price of the product.

shopping = [{"id": 1001, "Name": "HP-AE12", "Available": 100, "Price": 25000, "Original_Price": 24000},
            {"id": 1002, "Name": "DELL", "Available": 100, "Price": 35000, "Original_Price": 34000},
            {"id": 1003, "Name": "ASUS", "Available": 100, "Price": 28000, "Original_Price": 27000},
            {"id": 1004, "Name": "APPLE", "Available": 100, "Price": 60000, "Original_Price": 59000},
            {"id": 1005, "Name": "ACER", "Available": 100, "Price": 24000, "Original_Price": 23000},
            {"id": 1006, "Name": "SAMSUNG", "Available": 100, "Price": 35000, "Original_Price": 34000},
            {"id": 1007, "Name": "OPPO", "Available": 100, "Price": 15000, "Original_Price": 14000},
            {"id": 1008, "Name": "XAOMI", "Available": 100, "Price": 45000, "Original_Price": 44000},
            {"id": 1009, "Name": "HUAWEI", "Available": 100, "Price": 20000, "Original_Price": 19000},
            {"id": 1010, "Name": "VIVO", "Available": 100, "Price": 12000, "Original_Price": 11000}]

Code for the admin window in Online Shopping System Project in Python

In the code given below, which is for the admin window you can see the display menu, add product, remove product, product goods available, total income and logout.

def adminLoginWindow():
    print("=====================")
    print("1.Display Menu")
    print("2.Add Product")
    print("3.Remove Product")
    print("4.Products goods available")
    print("5.Total Income")
    print("6.Logout")
    print("=====================")

Code for the add products in Online Shopping System Project in Python

In the code given below, which is the admin can add products in the system.

ef addproducts():
    n = int(input("Enter the no.of.items need to be added : "))
    for i in range(n):
        new_id = int(input("Enter id : "))
        new_Name = input("Enter Name : ")
        new_Available = int(input("Enter Available : "))
        new_Price = int(input("Enter Price : "))
        new_original = int(input("Enter the original price : "))
        d = [{"id": new_id, "Name": new_Name, "Available": new_Available, "Price": new_Price,
              "Original_Price": new_original}]
        shopping.extend(d)
        adminDisplayMenuWindow()

Code for the remove products Online Shopping System Project in Python

In the code given below, which is the admin can remove products in the system.

def removeproducts():
    dressId = int(input("Enter the id need to be deleted : "))
    found = False
    for d in shopping1:
        found = d["id"] == dressId
        if found != True:
            temp.append(d)
            continue
        if found == True:
            d["Available"] -= 1
    print("Deleting item....")
    if len(temp) == d:
        print(f"{dressId} not found")
    else:
        print(f"{dressId}'s one available is removed from the list")
    adminDisplayMenuWindow()

Code for the total of available products in Online Shopping System Project in Python

In the code given below, which is the admin can see the total of available products

def availableproducts():
    Total = 0
    print("\n")
    for d in shopping:
        print(f'{d["Name"]} = {d["Available"]}')
        Total += (d["Available"])
    print("\nTotal available goods is : ", Total)

Code for the user login window in Online Shopping System Project in Python

In the code given below, which is for the user window you can see the display menu, place order, cancel order and logout.

def userLoginWindow():
    print("=====================\n")
    print("1.Display Menu")
    print("2.Place order")
    print("3.Cancel order")
    print("4.Logout")
    print("\n======================")

Code for the user to place an order in Online Shopping System Project in Python

In the code given below, which is for the user to place an order in the system.

def placeOrder():
    order_number = 10
    userDisplayMenuWindow()
    p_id = int(input("\nEnter the id : "))

    for d in shopping:
        if d["id"] == p_id:
            print("\nId\tName\tAvailable\tPrice")
            print("=============================================================")
            print(f'{d["id"]}\t{d["Name"]}\t{d["Available"]}\t\t{d["Price"]}')
            order = '{d["id"]}\t{d["Name"]}\t{d["Available"]}\t\t{d["Price"]}'
            conform = input("\nDo you want to place an order on the above shown product : Y/N ")

            if conform == 'Y' or conform == 'y':
                print("\nSuccessfully placed the order on the product {} {}".format(d["id"], d["Name"]))
                order_number += 1
                print("Your order number is : ", order_number)
                d["Available"] -= 1
                break

            elif conform == 'N' or conform == 'n':
                print("The order is not placed. You can carry on with you purchase. Happy shopping!!!!")
                break
            else:
                print("\nYou have entered wrong option. Please enter again\n")
                conform = input("\nDo you want to place an order on the above shown product : Y/N ")
                break

    if d["id"] != p_id:
        print("\nYou have entered invalid id. Please enter valid id\n")
        user_id()
    print("\nAvailable products : \n")
    userDisplayMenuWindow()

Code for the user to cancel order in Online Shopping System Project in Python

In the code given below, which is for the user can cancel his/her order in the system.

def cancelOrder():
    found = False
    temp = []
    order_id = input("Enter the order id : ")
    for d in shopping:
        found = d["id"] == order_id
        if found != True:
            temp.append(d)
    if len(temp) == d:
        print(f'{order_id} is not found')
    else:
        print(f'{order_id} is removed from the placed order')

Downloadable Source Code

Anyway, if you want to level up your programming knowledge, especially python, try this new article I’ve made for you Best Python Projects with source code for Beginners.

But If you’re going to focus on web development using Django, you can download here from our list of Best Django Projects with source code based on real-world projects.

How To Run The Online Shopping System Project in Python with Source Code?

To run this project, you must have installed a Pycharm on your PC (for Windows). This Online Shopping System Project in Python with Source Code is free to download, Use for educational purposes only!

After downloading the project you must follow the steps below:

1st Step: Unzip the file or Extract the file

2nd Step: Double click the main.py

3rd Step: Project is ready to run

Conclusion

This Online Shopping System Project in Python with Source Code can be useful to students or professional who wants to learn python programming language.

This project can also be modified to fit your personal requirements. Hope this project will help you to improve your skills. Happy Coding!

This Online Shopping System Project in Python with Source Code is the way to enhance and broaden our competencies and logic ideas which is essential in training the python programming language which is maximum well known and most usable programming language in lots of company.

If you’re looking for a PHP Project Online Shopping with Source Code you can click it here.

Related Article Below

Inquiries

If you have any questions or suggestions about Online Shopping System Project in Python with Source Code, please feel free to leave a comment below.

15 thoughts on “Online Shopping System Project in Python with Source Code”

Leave a Comment