Adding this code to functions.php seams that the empty space are fixed in shop page
add_action( ‘woocommerce_product_query’, ‘custom_woocommerce_product_query’ );
function custom_woocommerce_product_query( $q ) {
  if ( ! is_admin() ) {
    $oos_query = new WP_Query( [
      ‘meta_query’ => [ [
        ‘key’ => ‘_stock_status’,
        ‘value’ => ‘outofstock’,
        ‘compare’ => ‘=’,
       ], ],
      ‘post_type’ => ‘product’,
      ‘posts_per_page’ => -1,
      ‘fields’ => ‘ids’,
    ] );
    $exclude_ids = $oos_query->posts;
    $q->set( ‘post__not_in’, $exclude_ids );
  }
}
Now the problem is still present in “Ajax product tabs” and in the category widget (mismatch products count)