WooCommerce – force backordered products as “Out of stock”

<?php

add_filter( 'facetwp_index_row', function( $params, $class ) {
    if ( 'stock' == $params['facet_name'] && 1 == $params['facet_value'] ) {
        $post_id = (int) $params['post_id'];
        $product = wc_get_product( $post_id );
        if ( 'instock' !== $product->get_stock_status() ) {
            $params['facet_value'] = 0;
            $params['facet_display_value'] = 'Out of Stock';
        }
    }
    return $params;
}, 10, 2 );