title: Sort products by stock and price woocommerce
body: <p>I want to create a new sorting on Woo which sort like this:</p>
  <p>Product 1: stock_status =&gt; instock, price =&gt; 10;<br>
  Product 2: stock_status =&gt; outofstock, price =&gt; 20;<br>
  Product 3: stock_status =&gt; outofstock, price =&gt; 30;<br>
  Product 4: stock_status =&gt; instock, price =&gt; 40;</p>
  <p>New sorting result:</p>
  <p>Product 1: stock_status =&gt; instock, price =&gt; 10;<br>
  Product 4: stock_status =&gt; instock, price =&gt; 40;<br>
  Product 2: stock_status =&gt; outofstock, price =&gt; 20;<br>
  Product 3: stock_status =&gt; outofstock, price =&gt; 30;</p>
  <p>First by stock and then by price. I have this working but I don't know how to continue:</p>
  <pre><code>add_filter( 'woocommerce_catalog_orderby', 'misha_add_custom_sorting_options' );
  
  function misha_add_custom_sorting_options( $options ){
  
      $options['in-stock'] = 'Show products in stock first';
  
      return $options;
  
  }
  
  add_filter( 'woocommerce_get_catalog_ordering_args', 'misha_custom_product_sorting' );
  
  function misha_custom_product_sorting( $args ) {
  
      // Show products in stock first
      if( isset( $_GET['orderby'] ) &amp;&amp; 'in-stock' === $_GET['orderby'] ) {
          $args['meta_key'] = '_stock_status';
          $args['orderby'] = array( 'meta_value' =&gt; 'ASC' );
      }
  
      return $args;
  
  }
  </code></pre>
  <p>Any help will be appreciate it.</p>