Support » Plugins and Hacks » WooCommerce – Display price in theme template.

  • Hello,

    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 )

    and

    woocommerce_price( $this->sale_price)

    These sale_price and regular_price variables seem to be exactly want I want. But how do I display these within the theme?

    I’ve tried woocommerce_price( $product_id->regular_price ) with no luck.

    Can you please help or send over a link a any documentation which explain this?

    Many thanks,
    Steven

Viewing 2 replies - 1 through 2 (of 2 total)
  • HI, did you ever find a solution?

    I would also like the regular price to be Displayed, but I have a feeling it has something to do with Not all variations of a certain item being the same price, whether regular or sale.

    thanks
    -V-

    esmi

    (@esmi)

    Forum Moderator

    As per the Forum Welcome, please post your own topic. This topic is 9 months old!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce – Display price in theme template.’ is closed to new replies.