How can I use information in Views about whether a particular product is in this user's cart? Particularly, how many times into a Views row for that product?
For example, on a view listing available products, I'd like to be able to stylistically differentiate the rows representing products the customer has already added to their cart, and/or show a field, empty by default, stating how many of that item are already in the user's cart.
I've looked at existing Commerce modules such as Commerce Views Display and Commerce Add to Cart Extras, but can't see anything directly relevant. I'm not sure how to proceed with creating something to do this short of writing a custom Views query which also loads the Commerce cart for each row, which I'd rather not do since I'm not sure how I could make it reasonably efficient.
Does anything exist to support this, or if not, is there a simpler/more integrated, less "reinventing the wheel" approach using the Views and/or Commerce API?
An ideal result would be a Views Field for commerce products outputting a simple number representing how many times a product with this product ID is in the cart. Turning that into all the above use-cases is easy (e.g. rewrite as a class
product-in-cart-N then apply default styles to
.product-in-cart-0, simply display the field with a label, etc etc).