Support » Plugin: WooCommerce » Show the price only once in variable products?

  • Resolved hgieg



    When using variable products, prices are shown twice.

    Right below the product title appears the base price, within this DIV:
    <div itemprop=”offers” itemscope=”” itemtype=””>

    Below appears the price with selected variations, in this DIV:
    <div class=”single_variation_wrap” style=””>

    I would like to hide the base price, which is the first DIV, when the product is variable.

    Is it possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • An image to make it clearer:

    View post on


    Replace your price.php file with the following, i gather that if your wanting this on variable products you’ll also want this doing on grouped too..

     * Single Product Price, including microdata for SEO
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     1.6.4
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    global $post, $product;
    <?php if ( !$product->is_type( array( 'variable', 'grouped' ) ) ) : ?>
    <div itemprop="offers" itemscope itemtype="">
    	<p itemprop="price" class="price"><?php echo $product->get_price_html(); ?></p>
    	<meta itemprop="priceCurrency" content="<?php echo get_woocommerce_currency(); ?>" />
    	<link itemprop="availability" href="<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>" />
    <?php endif; ?>

    The above code on shows the price under the title when the product is not variable or grouped. you do lose your SEO this way though.

    Dear samueljeden,

    Your solution worked perfectly!

    I am deeply grateful.

    A tip for anyone reading this thread in the future:

    When upgrading Woocommerce, the file will be replaced by the original prices.php, undoing the changes.

    To ensure that does not happen, instead of directly changing the “prices.php”, create a folder in your theme called “woocommerce”, and inside another folder called “single-product”, in this folder create a file “prices.php” with content provided by samueljeden.


    I’m going to ask this here since Samueljeden was so helpful and knowledgeable 🙂 — I’m beating my head against a wall here…

    I’m using the variations as images/swatches plugin.
    I’ve got multiple choices for a product. Color and then packaging have to be selected.

    When the user selects their color and then their packaging option, I’d like those selections to be echoed above the price, in text and/or image form.

    Example, I click “cashmere” (color) and then “black designer jar” (packaging) by clicking on the swatches.

    The dynamic price apperas and above it, I’d like it to show thumbnails of my selections and/or the text/title of my selection (as confirmation of what the customer picks before they hit “add to cart”).

    Black Designer Jar

    Anyone know how to make this work? I’m desperate…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show the price only once in variable products?’ is closed to new replies.