You work a lot with offer prices? Then show your visitors how much they have saved compared to the original price.
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;