title: Adding variation on the fly and add to cart
body: <p>I need to change a product to variable, add a new variation, and add the product to the cart...this is what I have so far. I just want the cart to show the variable name...</p>
  
  <pre><code>//set the product to variable
  wp_set_object_terms($product_id, 'variable', 'product_type');
  
  //make a variation
  $thedata = Array('_course_calendar'=&gt;Array(
              'name'=&gt;'_course_calendar',
              'value'=&gt;'',
              'is_visible' =&gt; '1', 
              'is_variation' =&gt; '1',
              'is_taxonomy' =&gt; '1'
              ));
  
  
  update_post_meta($product_id,'_product_attributes',$thedata);
  
  
  //product_id,quantity,variation id,array
  $woocommerce-&gt;cart-&gt;add_to_cart($product_id,1,?,?);
  </code></pre>
  
  <p>The two question marks - the problem is how do I get the variation_id and what should I put in the array?</p>