title: Display the stock availability for all product types in Woocommerce archive pages
body: <p>I am using this code in showing the stocks of products:</p>
  
  <pre><code>    add_action( 'woocommerce_after_shop_loop_item', 'display_variable_product_stock_quantity', 10 );
  function display_variable_product_stock_quantity(){
      wc_get_variable_product_stock_quantity( 'echo_html' );
  } 
  
  function show_stock() {
  global $product;
  if ( $product-&gt;stock ) { // if manage stock is enabled 
  if ( ! $product-&gt;managing_stock() &amp;&amp; ! $product-&gt;is_in_stock() )
          echo '';
  }
  if ( number_format($product-&gt;stock,0,'','') &gt; 0 ) { // if stock is low
  echo '&lt;div class="remainingpc" style="text-align:center;"&gt;&lt;font color="red"&gt; ' . number_format($product-&gt;stock,0,'','') . ' Pcs Left&lt;/font&gt;&lt;/div&gt;';
  } 
  else {
  echo '&lt;div class="remaining" style="text-align:center;"&gt;&lt;font color="red"&gt;Out of Stock&lt;/font&gt;&lt;/div&gt;'; 
  }
  }
  
  add_action('woocommerce_after_shop_loop_item','show_stock', 10);
  </code></pre>
  
  <p>And if the product is a variable I use this answer code to display the stock availability:<br>
  <a href="https://stackoverflow.com/questions/52857156/get-the-total-stock-of-all-variations-from-a-variable-product-in-woocommerce/52861024#52861024">Get the total stock of all variations from a variable product In Woocommerce</a></p>
  
  <p>How can I merge this codes in a single conditional function? </p>
  
  <p>For example. if the products is a simple product, the other code for variable product will not display.</p>