I founded the next code, but it doesn’t work, the “woocommerce_single_product_summary” is the name of function? I can use it with variable products.
// Add save amount next to sale item prices.
function you_save_echo_product() {
global $product;
// works for Simple and Variable type
$regular_price = get_post_meta( $product->get_id(), '_regular_price', true );
$sale_price = get_post_meta( $product->get_id(), '_sale_price', true );
if( !empty($sale_price) ) {
$saved_amount = $regular_price - $sale_price;
$currency_symbol = get_woocommerce_currency_symbol();
$percentage = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 );
?>
<p class="you_save_price">You Save: <?php echo $currency_symbol .''. number_format($saved_amount, 2, '.', ''); ?></p>
<?php
}
}
add_action( 'woocommerce_single_product_summary', 'you_save_echo_product', 11 );