Get quantity of a specific product from the cart
I would like to query the cart to get the quantity of a specific product that is in it.
This is so that I can stop people adding more items to the cart, than is in stock.
For example, when a product page is loaded I will get the quantity of the cart contents for that item (if it exists) and subtract from the stock in the database, giving the available stock to the that customer at the time.
Could you point me in the right direction as to how I might do this?