Hello,
Try to add the following PHP code snippet to the child theme functions.php file to do this
add_action( 'init', 'wd_update_product_query' );
function wd_update_product_query() {
if ( class_exists('WOODMART_Stock_Status' ) ) {
remove_action( 'woocommerce_product_query', array( 'WOODMART_Stock_Status', 'show_in_stock_products' ) );
}
add_action( 'woocommerce_product_query', function ( $query ) {
$current_stock_status = isset( $_GET['stock_status'] ) ? explode( ',', $_GET['stock_status'] ) : array(); //phpcs:ignore
if ( in_array( 'instock', $current_stock_status, true ) || in_array( 'onbackorder', $current_stock_status, true ) ) {
$meta_query = array(
'relation' => 'OR',
);
if ( in_array( 'instock', $current_stock_status, true ) ) {
$meta_query[] = array(
'key' => '_stock_status',
'value' => 'instock',
'compare' => '=',
);
}
if ( in_array( 'onbackorder', $current_stock_status, true ) ) {
$meta_query[] = array(
'key' => '_stock_status',
'value' => 'onbackorder',
'compare' => '=',
);
}
$query->set( 'meta_query', array_merge( WC()->query->get_meta_query(), $meta_query ) );
}
} );
Kind Regards