Show Percentage Discount with Prices/Instead of price In WordPress/ Single Elementor Loop also

WooCommerce PHP July 23, 2026

Add this code in snippets and this will show percentage discount with price. You can hide the original price and then only percentage will show. You can use in in single product loop item in elementor.

CODE:

if ( !function_exists( 'evolution_custom_sales_price' ) ) :
/**
 * Show percent savings on sale - Only for WooCommerce version 3.0+
 *
 * @add filter to products
 *
 * @return filter
 */
function evolution_custom_sales_price( $price, $regular_price, $sale_price ) {
    $percentage = round( ( $regular_price - $sale_price ) / $regular_price * 100 ).'%';
    $percentage_txt =  __(' Save ', 'evolution' ).$percentage;
    $price = '<del>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) . $percentage_txt : $sale_price . ' ' . $percentage_txt ) . '</ins>';
    return $price;
}
add_filter( 'woocommerce_format_sale_price', 'evolution_custom_sales_price', 10, 3 );
endif;