And your suggested code:
add_filter( ‘woocommerce_get_availability’, ‘custom_get_availability’, 1, 2);
function custom_get_availability( $availability, $_product ) {
global $product;
$stock = $product->get_total_stock();
if ( $_product->is_in_stock() ) $availability[‘availability’] = ‘<div>My html code for the icon In Stock</div>’;
return $availability;
}
it just gives a “<div>My html code for the icon In Stock</div>” text (or code) in Product Description area. And I was talking about bade on the product image – like a “OUT OF STOCK” or “SALE!” badges. How to do this badges?
For example is product is availible – we got IN STOCK badge on product image, and if product is not in stock – there is no badge on image (now there is OUT OF STOCK badge and I dont need it in that case if we got IN STOCK badge)