I have implemented You Saved x%(discount percentage) in simple product detail pages using the following code :
add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 );
function woocommerce_custom_sales_price( $price, $product ) {
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
return $price . sprintf( __(' You Save: %s', 'woocommerce' ), $percentage . '%' );
Is there any option to implement this in the case of variable product . Tried with "woocommerce_variable_sale_price_html" hook but it is not working . I need to show the discount percentage when the user select one combination .