I debugged the code and saw these new function is making the difference:
public function get_stock_status( $stock_status, $product ) {
$product = Helpers::get_atum_product( $product );
$stock = $product->get_stock_quantity();
$oost = $product->get_out_stock_threshold();
if ( $stock < 1 && 'instock' !== $stock_status && $stock > $oost ) {
$stock_status = 'instock';
}
return $stock_status;
}
I have out of stock threshold feature turned off so I don't have any out_stock_threshold meta key in my db.
get_out_stock_threshold always returns ''.
When $stock == 0, ''>0 is true in php, what makes all the items in the shop get
$stock_status = 'instock'
Thanks,
Asaf