This question already has an answer here:
- Display the discounted percentage near sale price in Single product pages for WC 3.0+ 1 answer
I had this code in function.php of my child theme to display the regular price and sale price and it was working fine in WooCommerce v2.6.14.
But this snippet doesn't work anymore on WooCommerce version 3.2.3.
How can I fix that?
Here is that code:
add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 );
function woocommerce_custom_sales_price( $price, $product ) {
$saved = wc_price( $product->regular_price - $product->sale_price );
return $price . sprintf( __('<p>Save %s</p>', 'woocommerce' ), $saved );
}
Thanks to whoever help me out!