Remove stock status for specific product tag - Woocommerce Remove stock status for specific product tag - Woocommerce wordpress wordpress

Remove stock status for specific product tag - Woocommerce


You should try woocommerce_stock_html filter hook for this purpose:

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 ) ) :        // Define here your text to replace        $availability_html = __( 'Say something here', 'woocommerce' );    endif;    return $availability_html; };  

This code is tested, and I hope is what you are expecting to get.

Code goes in function.php file of your active child theme (or theme). Or also in any plugin php files.