Shopping cart in python

Dennis Moyo
1 min readSep 17, 2018

--

As a developer one of my favorite web applications is e-commerce. I love them for their great UI and how convenient it is to use. As a python dev already made e-commerce solutions exist such as django-oscar and saleor. I’ve had experience in both and they are both good, but what if you wanted to create your own from scratch? I know many developers want to experiment and customise their sites without restrictions, so i’ve decided to show you how i would do it using pure python code.

Note: Here i use django but any python framework will do. I will skip the basics of using django. Now let’s begin.

  1. Create your model for Item

2. Run migrations then create cart.py file

3. Finally views.py

In templates you can just render the variables as neat buttons and that’s it! This was a simple way that i would add shopping cart functionality into my application.

Note this code is meant as a guide, just to show you how you may go about it. Hope this was helpful!.

Note: If you already have your own e-commerce store setup and want to learn how to market it like an expert for FREE click here: https://olspsystem.com/join/136568

--

--