Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #8503

    Is there anyway to get the price to show up on and individual product page, similar to the Abundance theme?

    I can manually enter some text in the ‘Excerpt’ field when creating a product, however I would like to use some code instead, hopefully to reflect a price change or sale in the back-end.

    Thank you



    I think you can use following code:

    echo $product->get_price_html();

    to display the price. I’d add it to flashlightwoocommerce-configconfig.php – search for following function

    function avia_woocommerce_before_shop_loop()

    and add the php code somewhere to it.


    I got this error:

    Fatal error: Call to a member function get_price_html() on a non-object in /public/sites/ on line 347



    There seems to be no easy way of adding the price on a single product view yet. For the mean time, you can add the price on the Attributes tab.

    Best regards,



    Ok. Thanks.


    The other way is to look for meta.php on plugins > woocomerce > templates > single-product. And replace everything with this:

    * Single Product Meta

    global $post, $product;
    <div class="product_meta">

    <?php if (($product->is_type('simple') || $product->is_type('variable')) && get_option('woocommerce_enable_sku')=='yes') : ?>
    <span itemprop="productID" class="sku"><?php _e('SKU:', 'woocommerce'); ?> <?php echo $product->sku; ?>.</span>
    <?php endif; ?>

    <p itemprop="price" class="price"><?php echo $product->get_price_html(); ?></p>

    <?php echo $product->get_categories( ', ', ' <span class="posted_in">'.__('Category:', 'woocommerce').' ', '.</span>'); ?>

    <?php echo $product->get_tags( ', ', ' <span class="tagged_as">'.__('Tags:', 'woocommerce').' ', '.</span>'); ?>



    Ismael’s solution above adds it to the product meta, which I think looks rather out of place.

    My solution was to add:

    <p itemprop="price" class="price"><?php echo $product->get_price_html(); ?></p>

    to the plugins/woocommerce/templates/single-product/add-to-cart/simple.php

    I also recommend adding it to variable.php in the same directory.

    I’m still not satisfied with the placement of the price, it would be ideal if “from : $15” got replaced by the actual price when the user makes their selection, but I think for now this will have to do.


    Hello Patrick,

    Thanks for the solution. This is very useful.



Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Displaying price of product on product page’ is closed to new replies.