Hi! As promised, a follow up now that 3.1.1 is released. You can use the following filter to include “In stock” text in the search for products that are in stock:
add_filter( 'wc_bulk_order_form_label','wc_bulk_order_form_label_stock', 10, 6 );
function wc_bulk_order_form_label_stock( $label, $price, $title, $sku, $active_currency, $product = null ) {
if ( $product && $product->managing_stock() ) {
if ( $product->get_stock_quantity() > 0 ) {
$label = sprintf( "%s - %s", $label, __( 'In stock', 'woocommerce' ) );
}
} else {
$label = sprintf( "%s - %s", $label, __( 'In stock', 'woocommerce' ) );
}
return $label;
}
Or a more advanced version that prints the amount that is in stock:
add_filter( 'wc_bulk_order_form_label','wc_bulk_order_form_label_stock', 10, 6 );
function wc_bulk_order_form_label_stock( $label, $price, $title, $sku, $active_currency, $product = null ) {
if ( $product && $product->managing_stock() ) {
$stock_amount = $product->get_stock_quantity();
$display = sprintf( __( '%s in stock', 'woocommerce' ), wc_format_stock_quantity_for_display( $stock_amount, $product ) );
$label .= " ({$display})";
}
return $label;
}