title: WooCommerce auto complete orders with virtual products
body: <p>WooCommerce auto complete orders which has products marked as virtual &amp; downloadable type.. while it puts orders into processing not complete status if its a virtual product only.</p>
  
  <p>What if we need to auto complete orders with virtual products too instead of putting it in processing ?</p>
  
  <p>We found this but it auto completes all orders not just the virtual products</p>
  
  <pre class="lang-php prettyprint-override"><code>/**
   * Auto Complete all WooCommerce orders.
   */
  add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
  function custom_woocommerce_auto_complete_order( $order_id ) { 
      if ( ! $order_id ) {
          return;
      }
  
      $order = wc_get_order( $order_id );
      $order-&gt;update_status( 'completed' );
  }
  </code></pre>
  
  <p>We need to auto complete the orders have virtual products as it happens for the orders with products marked as virtual &amp; downlodable</p>