For the life of me I can’t seem to display the simple product price in my theme. Most of the time I use this function:
<?php echo $product->get_price_html(); ?>
This seems to be the crème de la crème and everyone must be satisfied with this solution as I can’t find anything on the net otherwise :-). However, the problem with this is that it echos both the sale price and the regular price within it’s predefined HTML code layout.
I want to be able to echo the sale price and regular price separately so I have more flexibility in designing themes.
Looking into this function I see the following is used in the WC product variation class:
woocommerce_price( $this->regular_price )
These sale_price and regular_price variables seem to be exactly want I want. But how do I display these within the theme?
woocommerce_price( $product_id->regular_price )with no luck.
Can you please help or send over a link a any documentation which explain this?
- The topic ‘WooCommerce – Display price in theme template.’ is closed to new replies.