If you have your product on sale, sometimes you’d like to show the savings from that sale instead of just the sale badge. The following code snippet would allow you to do just that.
Please note that in variable product, it tries to show the maximum savings possible. So it is advised to add “upto” in the sale badge.
The custom code is given below. Please paste the code below in your child theme’s functions.php, please make sure to copy from line 2 only.