For this purpose, you should try the woocommerce_stock_html filter:
add_filter( 'woocommerce_stock_html', 'filter_woocommerce_stock_html', 10, 3 ); function filter_woocommerce_stock_html( $availability_html, $availability_availability, $variation ) { global $product; if ( has_term( 'Preorder', 'product_tag', $product->ID ) ) :
This code has been tested, and I hope this is what you expect to receive.
The code goes in the function.php file of your active child theme (or theme). Or also in any php file plugins.
source share