I would like to display the variable price by default in the “from price tab” in the single product page. and not have the from price.
Its confusing to the shopper to see a “from” price then below it a price for each variation, that changes once a variation is chosen.
see attached image
So instead of having to sets of price fields I want to display only one where its a single or variable product.
The function
woocommerce_template_single_price()
handling the display of the “normal” price is pluggable, which means it can be overridden putting this into yourfunctions.php
:This works because in
woocommerce-template.php
the functions gets initiated like this:As you can see the conditional says if the function not exists, but the function already exists. The one we put into the
functions.php
will be used, because it is initiated earlier.To show the the variation price when a single product page with a variable product is loaded, you have to select a default product variation on the product edit page.
I’m using the “Porto” Theme and haved this problem too. You can solve the problem, putting this code into your
functions.php
from your child theme:Than your price looks like a single price and it the cheapest price from your variable product. It works. I’ve used it.