Skip to content
Advertisement

Display the WooCommerce product price (with discount) in a custom template

I need to display a product in a specific template.

Here is the template code:

JavaScript

I would like to display the price (with discount) and the old price.

JavaScript

how can I change this variable?

Advertisement

Answer

Simply use instead the WC_Product method get_price_html() like:

JavaScript

Or if you want only one formatted price when product is on sale, you will use:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement