// Removing sale badge
add_filter('woocommerce_sale_flash', '__return_false');
// Removing archives prices
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
// Add the saved discounted percentage to variable products
add_filter('woocommerce_format_sale_price', 'add_sale_price_percentage', 20, 3 );
function add_sale_price_percentage( $price, $regular_price, $sale_price ){
// Strip html tags and currency (we keep only the float number)
$regular_price = strip_tags( $regular_price );
$regular_price = (float) preg_replace('/[^0-9.]+/', '', $regular_price);
$sale_price = strip_tags( $sale_price );
$sale_price = (float) preg_replace('/[^0-9.]+/', '', $sale_price);
// Percentage text and calculation
$percentage = __('Save', 'woocommerce') . ' ';
$percentage .= round( ( $regular_price - $sale_price ) / $regular_price * 100 );
// return on sale price range with "Save " and the discounted percentage
return $price . ' ' . $percentage . '%';
}