Sort products by Sale price and stock status

Try this.

I followed the WP_Query docs to build this.

$args = [
    'meta_query' => [
        'relation' => 'AND',
        [
            '_stock_status' => [
                'key'     => '_stock_status',
                'compare' => 'EXISTS',
            ],
            '_sale_price' => [
                'key'     => '_sale_price',
                'compare' => 'EXISTS',
            ],
            '_price' => [
                'key'     => '_price',
                'compare' => 'EXISTS',
            ]
        ]
    ],
    'orderby' => [
        '_stock_status' => 'ASC',
        '_sale_price'   => 'DESC',
        '_price'        => 'DESC'
    ]
];

This will order by stock first, sale price second and price third.

There is no way to order by two or more values simultaneously, at least not that I know of or could find.