title: Get all product variations of a product given its ID in Woocommerce
body: <p>I have a custom page where I'm trying to list every products in the store along with their variations. </p>
  
  <p>Also, I'm trying to list the variations' prices sorted by the product attribute with slug 'size'</p>
  
  <p>For testing, I'm trying to get the variations of a single product with the ID 381
  My code yet is</p>
  
  <pre><code>    $handle=new WC_Product('381');
      $variations1=$handle-&gt;get_avaialable_variations();
      foreach ($variations1 as $key =&gt; $value) {
              echo '&lt;option  value="'.$value['variation_id'].'"&gt;'.implode('/',$value['attributes']).'-'.$value['price_html'].'&lt;/option&gt;';
  
      }
  </code></pre>
  
  <p>But the error I'm getting is </p>
  
  <pre><code>PHP Fatal error:  Call to undefined method WC_Product::get_avaialable_variations() 
  </code></pre>
  
  <p>I tried using </p>
  
  <pre><code>$handle=new WC_Product_Variable('381');
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code> $handle=new WC_Product('381'); 
  </code></pre>
  
  <p>But the error is the same. </p>
  
  <p>Any help here?                      </p>