Product Option Shows Price Twice | Wordpress WooCommerce

In Wordpress WooCommerce, when I add Variation Product, the variation is set in only two colors,

Starwhite = 9000 Ivory = 15000

On the Single Product page, I see that the price is mentioned twice, as shown in the screenshots.

I want to keep the price defined in the variation. Remove another.

A price that is not required is displayed below the div below

<div itemprop="offers" itemscope="" itemtype="http://schema.org/Offer"> <p class="price"><span class="amount">Rs.9,000.00</span><span class="amount">Rs.15,000.00</span></p> <meta itemprop="price" content="9000" style=" /* display: none; */ "> <meta itemprop="priceCurrency" content="INR"> <link itemprop="availability" href="http://schema.org/InStock"> </div> 

But when I note that it has no display or the visibility is hidden, the price of the variation also did not disappear.

enter image description here

Color Change Settings 1: enter image description here

Color Change Settings: enter image description here

In addition, there are times when I use the Simple product on a website, so any proposed changes should not affect the simple parameters of the product.

If I need to make any changes to the code, what should be the code and under what php file should it be changed.

+5
source share
1 answer

I believe that the file you need to edit is "/single-product/price.php", you should have a copy of this file in the theme folder (/your-theme/woocommerce/single-product/price.php), if no, you can copy it from / wp -content / plugins / woocommerce / templates /

Edit:

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

To:

 <?php if( $product->is_type( 'simple' ) ){ ?><p class="price"><?php echo $product->get_price_html(); ?></p><?php } ?> 

This will only display the price for simple products. Another price display that changes when another option is selected is set to / single -product / add-to-cart / variable.php, so it will not be affected.

+5
source

All Articles