Woocommerce: Show stock count as "10+ in stock" if there are more than 10 in stock

By default, Woocommerce displays the stock count as a precise number, e.g. "7 in stock". However, if you prefer to show a more generalised statement like "10+ in stock" if the stock quantity exceeds a certain number. For example, 10.

This feature allows this and shows the number in stock when you are under 10 and if the number in stock is over 10 it is shown as "10+ in stock". If the product is out of stock, it will write "out of stock" text.

Single-product availability @@ lennartc
function wcStock($availability)
    global $product;
	if ($availability === 'outofstock') {
	echo '' . __('Product is currently unavailable', 'cco') . '';
	if ($availability === 'instock') {
	    	    $antal = $product->get_stock_quantity();
	    	    if ($antal > 10) {
			        $antal = '10+';
	echo '<span class="your_styles"&gt';
	    	    echo $antal ? $antal . ' ' : ''; echo __('In stock', 'cco') .' - '. __('Fast delivery', 'cco') .'</span&gt';

The above code can be used and you can edit it. The texts are in English and can be translated with your theme's text domain, in the above example 'cco'.

Use the function like this: