Simplecart.js Check if Simplecart_Items has items

You can try this way in V3 of the simplecartjs script,
if(simpleCart.items().length == 0)
{
//No items in the cart
}
If you want to check a particular item already present in the cart, using jQuery.
simpleCart.bind('beforeAdd', function (item) {
  if (simpleCart.has(item)) 
  {
      alert("Already in the Cart");
      return false;
  }
});
Đọc thêm..