wojodesign/simplecart-js — Issue #202: Check if item already exists?
Author: ggeiger
Created: 2012-02-09 20:54:18+00:00
State: open

I'm using simpleCart to create a list of favorite items. Each item should only be added to the cart once. I'd like to toggle the 'add to cart' button with a 'saved' button that is disabled, so the user cannot add it again until it is removed.

I thought to check against the item name, or the quantity. Then realized I don't know how to do that!

The toggle I have so far is:

simpleCart.bind( 'afterAdd' , function( item ){
$(".item_add").fadeOut(function(){
$('.saved').fadeIn();
});
});

This toggles all items to show the 'saved' button. I need a way to check the cart to see if it's in there already.