How to display WooCommerce sale price or regular price if there is no sale price?

Posted by Prem Tiwari | Updated on

Want to display WooCommerce sale price or regular price if there is no sale price? Pretty simple. We’ll write a custom function that will first be sure on that if the product is on sale or not. Then it’ll return regular or sale price based on the sale condition it defined previously.

Now call this function the_dramatist_price_show() instead of $product->get_price_html(). You’ll get the price based on is on sale or not without currency symbol.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers