title: Get Woocommerce product variations outside loop
body: <p>I'm trying to list product variations and prices for each variation outside of woocommerce templates.
  Anyone can suggest how can I access that info?</p>
  
  <p>I have tried to do something like this:</p>
  
  <pre><code>$tickets = new WC_Product( $product_id);
  $variables = $tickets-&gt;get_available_variations();
  </code></pre>
  
  <p>But this doesnt work because it is outside of loop, it returns error.</p>
  
  <p>Idealy I would like to get all variations like an array:</p>
  
  <pre><code>$vars = array(
   array('name' =&gt; 'My var name', 'price' =&gt; '123'),
   array('name' =&gt; 'My var name', 'price' =&gt; '123'),
  );
  </code></pre>
  
  <p>Maybe even if this can be done on 'save_post' for every product to create new post_meta and save this for future use, which would then be available to get like:</p>
  
  <pre><code>$meta = get_post_meta( $product_id, '_my_variations' );
  </code></pre>
  
  <p>Any suggestion is welcome.</p>