Ready to get started?Download WordPress


WooCommerce - excelling eCommerce
[resolved] Tweak price display on page (6 posts)

  1. eventkonsulterna
    Posted 6 months ago #

    Hi guys!
    I just updated to the latest woocommerce version and now all products show the lowest to highest price (variable products) on the product page and in category list.

    Before it only showed the lowest price like I wanted it to.
    Can anyone help to get it back that way?

    This line that makes it: woocommerce/templates/single-product/price.php
    <p class="price"><?php echo $product->get_price_html(); ?></p>

    That now looks like [low] - [high] and I want it to just show the low price. Thank you


  2. Feddman
    Posted 6 months ago #

    I have the same issue. For the time being, I've made a little css tweak to get things back to how it previously showed.

    .price .amount:nth-of-type(2) {
      display: none;
    .price {
      color: rgba(0,0,0,0.0);

    First block selects the second amount span (which is the one with highest price value and displays it to none

    Second block just makes the little dash in between transparent, so it doesn't show. (haven't come up with a more clever solution to hide text which is not in between tags just yet...)

    It might be a bit of a dirty solution, but works for the time being. I sure hope someone comes up with a more elegant solution...

  3. AncaIO
    Posted 6 months ago #

    Hi there.

    There are two snippets you can start from here, depending on whether you have sale prices or just regulars (untested): https://gist.github.com/angryoaf/5380297

    For regular price variations, I use this and it worked great for me:

    add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
    function custom_variation_price( $price, $product ) {
    	$price = '';
    	if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) {
    		$price .= '<span class="from">' . _x('From', 'min_price', 'woocommerce') . ' </span>';
    		$price .= woocommerce_price($product->get_price());
    	return $price;

    Let me know if it worked for you or if you require further assistance with this.

  4. Coen Jacobs
    Plugin Author

    Posted 6 months ago #

    We have added a workaround for this to our list of common issues (with a similar script as posted above): Revert variation price ranges back to the WooCommerce 2.0 format.

  5. eventkonsulterna
    Posted 6 months ago #

    The workaround works great! Thank you all for your fast help!

  6. queenb123
    Posted 1 week ago #

    This does not work for me i am getting a syntax error can anyone help me please, i am not good at coding, i have copied and pasted the above code into my functions.php (not the child theme tried that and it did not work),i really need help what do i do please?


You must log in to post.

About this Plugin

About this Topic