title: Get Product variations based on product id
body: <p>I have created a custom template for product and I want to show the product variations on single product but not able to do it can anyone tell me how to get variations  here is my code </p>
  
  <pre><code>$productId = $_POST['product_id'];
      $product = wc_get_product( $productId );
      //print_r($product);
      $image = wp_get_attachment_image_src( get_post_thumbnail_id( $productId ), 'single-post-thumbnail' );
      $product_data .='&lt;div class="row"&gt;&lt;div class="col-sm-12"&gt;';
      $product_data .='&lt;img src="'.$image[0].'"&gt;';
      $product_data .= '&lt;h4 class="title"&gt;'.$product-&gt;get_title().'&lt;/h4&gt;';  
      $product_data .= '&lt;p class="prodis"&gt;'.apply_filters( 'the_content', get_post_field('post_content', $productId) ).'&lt;/p&gt;'; 
      $product_data .= '&lt;p class="proprice"&gt;'.$product-&gt;get_price_html().'&lt;/p&gt;';
      $product_data .= '&lt;p class="addcardft"&gt;'.do_action('woocommerce_simple_add_to_cart').'&lt;/p&gt;';
      $product_data .='&lt;/div&gt;&lt;/div&gt;';              
      echo $product_data;     
  </code></pre>