DevKen PHP Cart Class

DevKen PHP Cart Class

Released 7 years ago , Last update 7 years ago

Cart class that works with wishlists, carts and recognizes products smartly.

The DevKen Cart Class addresses an issue that I ran into several times while developing ecommerce websites. Customers wanted shopping carts that fit their needs exactly in design and aesthetics. I used a couple free versions for a few projects and found myself spending more time modifying them than I should have had to. So I decided to roll my own shopping cart class that would provide just what was required. It saved the list of products that users wanted to save and organized them in a way that makes it easy to display and calculate.

The Cart class handles any type of list that you need to manage. I also use it to maintain a history of products that users have visited and I use it to keep track of wishlists and download lists at the same time. It is very versatile and easy to integrate into any project. It is well documented and comes with a demo that works right out of the box. Just place it on your webserver and load it up.

  • 5 2
  • 4 0
  • 3 0
  • 2 0
  • 1 0
2 Reviews Read Reviews


14 day 14-day money-back guarantee


Personal License

  • Perpetual license

  • 1 site, unlimited servers

  • No distribution (hosted use only)

  • Commercial use

Example Usage

$cart = new Cart;       

// create a new item array - ID is required
$item = array('id'=>132,'qty'=>'1','color'=>'blue','size'=>'large');    
// Add item to cart

// Add two more items with the same ID (no overwrite)
$item['qty'] += 2;      

// Change the item color, a new item will be added this time
$item['color']  = 'white';  

// Remove item by index

// Update item properties by index

// Empty the cart

// Dump the cart for debugging

// Get the cart for processing
$cartItems = $cart->getCart();      
foreach($cartItems as $item) {
      // Process cart 
1 license From » $9.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.

Or enter your name and Email
  • M Mick89 License holderPersonal License
    Purchased on Jun 5, 2014
    3 years ago
    Hi, Is your class always valid? I have a price field in my array session. Also, is it possible to add a function to obtain the total price? Thanks again! Mick
  • M Mick89 License holderPersonal License
    Purchased on Jun 5, 2014
    4 years ago
    Hi, Interesting ! Is there a demo available? It calculates the additional costs (VAT, delivery…) ? Require PHP Mysql? Thanks! Mick
    • KE Ken Elliott Publisher 4 years ago
      The demo is currently down thanks to $%#*ing godaddy. It does calculate additional costs on a per item basis.
    • KE Ken Elliott Publisher 4 years ago
      Also it does not required MySQL, however it does require PHP4 or greater.
    • M Mick89 4 years ago
      Is it possible to use it with your script DevKen PHP Cart Calculator Class ? Thanks again !
    • KE Ken Elliott Publisher 4 years ago
      Mick89, yes they are built for each other.
    • M Mick89 4 years ago
      Great ! Do you have an example (or documentation) which associates the two class? Thanks !
  • TW Tom Webb License holderPersonal License
    Purchased on May 12, 2014
    4 years ago
    Anyone know if this class saves the cart using sessions/cookies? Thanks