woothemes/woocommerce — pull request #5896 by helgatheviking (2014-07-24 18:14:09+00:00)
Title: use $product object data to add variations directly to cart

In the `add_to_cart()` method of the cart class, there's a bit of code to modify the `$product_id`, `$variation_id`, etc if the `$product_id` is directly a variation. You're getting the product object via `get_product()` so why not use that data to get the `$product_id` and `$variation_id` instead of making calls to extra functions?

Additionally, this will assign the variations attributes. If core is already doing this, then extensions won't need to duplicate efforts and get the product objects themselves. The `$variation` needs to be defined to show the variation's attributes automatically in the cart/order sections.