Skip to main content

Shopping Cart with Checkout Using CodeIgniter


This shopping cart is using CodeIgniter framework that allows you to add/update/delete a product from the cart. I am using the database in my previous post as a fixed on the existing shopping cart I found in the internet.

This code is totally different from the code at “How to Build Shopping Cart w/ Checkout in PHP”. It has a cleaner code, secured and most importantly easy to understand.

Shopping cart with checkout using CodeIgniter is part of the tutorial that I am currently working. I will explain this one by one on how I created this code in the next few days.

It's so easy to create a cart using CodeIgniter. Here's an example code:

public function add() { $this->load->model('Cart_model'); $insert_room = array( 'id' => $this->input->post('id'), 'name' => $this->input->post('name'), 'price' => $this->input->post('price'), 'qty' => 1 ); $this->cart->insert($insert_room); redirect('cart'); }

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Submitted byAnonymous (not verified)on Thu, 02/21/2013 - 15:17

Is it possible to get database of this turorial or not even fields name? i am stuck without db..

Submitted byAnonymous (not verified)on Sat, 03/30/2013 - 10:14

thanls you very much

Submitted byAnonymous (not verified)on Wed, 07/03/2013 - 19:09

Hi, I wonder if you are able to mail me that db-file("shopping")that seems to be used in the database config file. Please send it to [email protected]

Regards Bengt (from Sweden)

Submitted bybikash ranjan nayak (not verified)on Thu, 07/25/2013 - 01:58

thank u very much its help more for bignner:)

Submitted bynewbe (not verified)on Mon, 02/03/2014 - 23:16

how to use this in xampp
and the how can i import the database?

Submitted byKichi (not verified)on Tue, 02/11/2014 - 02:10

How to connect code billing.php, cart.php, & products.php!?

Submitted byMark_alot (not verified)on Thu, 03/12/2015 - 07:00

$config['base_url'] = 'http://localhost/codeigniter_cart/';
$config['index_page'] = 'index.php';

what exactly do i change?

Submitted byIqbal Butt (not verified)on Tue, 11/15/2016 - 00:01

Thank you so much for all these code snippets it's really helpful and easy to understand :)

Submitted byIteleh (not verified)on Sat, 06/16/2018 - 18:16

You don't have permission to access /Shopping/cart/add on this server.
when i try to add to cart

Submitted byVaishak b (not verified)on Mon, 09/09/2019 - 10:20

Please tell me where is the database or sql file

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.