Display the discounted percentage near sale price in Single product pages for WC 3.0+
I had this code in function.php of my theme to display the percentage after price and it was working fine in WooCommerce v2.6.14. But this snippet doesn't work anymore on WooCommerce version 3.0+. How can I fix that? Here is that code: // Add save percent next to sale item prices. 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( __(' Save %s', 'woocommerce' ),