I would like to know what would be the code to change woocommerce_sale_flash from the default text which is “Sale!” to the Discount Percentage you actually are saving.
Just now I have this piece of code which changes the text of the sale flash icon:
add_filter('woocommerce_sale_flash', 'my_custom_sale_flash');
function my_custom_sale_flash($text, $post, $_product) {
return '<span class="onsale"> Discount!</span>';
}
Instead of displaying the same text each time, it should display the actual discount (for example: 25% off) of the product.
Try out this :