I tried this function I found in the docs but it doesn’t work
add_filter(
'aws_search_results_products'
,
'my_aws_search_results_products'
);
function
my_aws_search_results_products(
$products
) {
usort(
$products
,
function
(
$item1
,
$item2
) {
$product1
= wc_get_product(
$item1
[
'id'
] );
$product2
= wc_get_product(
$item2
[
'id'
] );
if
(
'outofstock'
!==
$product1
->get_stock_status() ) {
return
-1;
}
if
(
'instock'
!==
$product2
->get_stock_status() ) {
return
1;
}
return
0;
});
return
$products
;
}