Plugin for shopping cart simplification
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

#Shopping Cart jQuery Plugin

Shopping Cart simplified


Shopping Cart plugin has been created with essence to simplify the process of making shopping carts for the websites that need a proper interface for customers. With number of functions available, it all works as a breeze. Code is heavily commented for easy understanding.


Include the plugin as follows:-

<script type="text/javascript" src="jquery.js"/>
<!-- Must include jQuery before including plugin -->
<script type="text/javascript" src="jquery.cart.js">

All the methods for the cart are available through $.cart variable.

There is an orderid defined for each item along with its quantity.

Functions available are as documentated below:

$.cart.set( orderId, count );
//To set an order with quantity = count in the cart.
//Important: If item is already present this count will be added to current quantity

//Get an object containing orders with attributes id and count

//Get a JSON string of the orders.

//Get total number of types of.

//Get total nuber of.

/* For example:- If you have bought 2 Lays' and 1 Uncle Chipps
   $ will be 2 and $.cart.totalQty() will be 3

$.cart.remove( orderId, count );
//To remove a certain amount of count from item with id = orderId.

$.cart.removeItem ( orderId );
//To remove whole quantity of a particular item.

//To clear the whole cart

$.cart.change( orderId, count );
//To change the quantity of the orderId to count.

//To remove the cookie in which all the data of cart is stored.

By default orders are stored in cookie named 'orders'.

You can override it by setting $.cookie.defaults.

$.cookie object is also available to play with cookies all over.

###License MIT License

Copyright (c) 2014 Amanpreet Singh