woothemes/woocommerce — pull request #4082 by thenbrent (2013-11-09 01:10:10+00:00)
Title: Check products are purchasable when restoring cart

Because `WC_Product::is_purchasable()` is only called when adding a product to the cart, it's possible to purchase products that aren't purchasable (but were once purchasable when they were first added to the cart).

This patch checks all of the cart's contents when restoring the cart to make sure that each of them is purchasable. If they're not, it removes them from the cart session, doesn't add them to the cart and display's an error message notifying the customer that the item was removed.

It's tested & working, but I'm not sure what I've done to remove the item from the cart session, i.e. [`$woocommerce->session->cart = $this->cart_contents`](https://github.com/thenbrent/woocommerce/commit/1d599b5#diff-6d49d784315a8c9815e4f600dafe95e6L150) is the best approach.