On WooCommerce product single pages, if a product owns a sales price, the normal price is crossed out and behind it, the sale price is highlighted.
My question:
How can I add a label like "Old Price: XX Dollar"
and "New Price: XX Dollar"
instead of only the crossed out and the new price (sale price)?
when products are on sale, you can add custom labels just as you want using a custom function hooked in
woocommerce_sale_price_html
andwoocommerce_variation_sale_price_html
filters hooks (for simple and variables products.For the min / max prices in variables products, we need a different function hooked in
woocommerce_variation_sale_price_html
filter hook.Here is that code:
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested and works.
Related answers: Conditional custom output around products sale price and regular price
In admin side you need to define your sale price and actual price so it will automatically reflect in front side as your old price and new price alternatively.
Also you need to do some code for this.