Disable WooCommerce From: $$ Price

woocommerce banner

One of the requests I hear all the time is how to remove the WooCommerce “From: $$” price on the variable product page. Some people feel that it adds unnecessary clutter to the page. The good news here is that WooCommerce is incredibly flexible. With a simple filter you can modify that price however you want or remove it entirely.

Disable From Price Plugin

I've created a small plugin that you should be able to drop into your wp-content/plugins folder, activate it, and you're done!


<?php
/**
* Plugin Name: WooCommerce Remove Variation "From: $XX" Price
* Plugin URI: https://gist.github.com/BFTrick/7643587
* Description: Disable the WooCommerce variable product "From: $X" price.
* Author: Patrick Rauland
* Author URI: http://patrickrauland.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Patrick Rauland
* @since 1.0
*/
function patricks_custom_variation_price( $price, $product ) {
$target_product_types = array(
'variable'
);
if ( in_array ( $product->product_type, $target_product_types ) ) {
// if variable product return and empty string
return '';
}
// return normal price
return $price;
}
add_filter('woocommerce_get_price_html', 'patricks_custom_variation_price', 10, 2);
// that's all folks!

Gotcha's

The only gotcha for this plugin is that it will always hide the from price. This includes the case where all of the variation prices are the same so the price right above the add to cart button is hidden and now you're hiding the top price. To mitigate this you would have to modify this filter to check to see if the prices are different and then return an empty string.

54 thoughts on “Disable WooCommerce From: $$ Price

  1. Awesome share Patrick! I literally had to solve this issue last Friday, but needed to keep the price of products that have variations with the same price. My solution was a little more involved, but I’ll share a gist a little later today.

  2. […] for some WooCommerce hints/tools? Check out How to remove “From: $$” from your product catalog by Patrick Rauland or How to Add Order Notes To WooCommerce Completed Order Email by Remi Corson. […]

  3. Should this still work, or has a WooCommerce update since then prevented it? Either way, activating this plugin seems to have no change on my site.

    • Hi K,

      Sorry for the delay in my response. I’ve been quite busy with work. Nothing should have changed. This is most likely a conflict or something else. Try this with just WooCommerce & Twenty Twelve activated.

  4. Is it possible to edit it to show the lowest price of the variables in the archive loop?

    • I’m sure this is possible but I believe you’d have to use different filters. Off the top of my head I don’t know which ones you would need. I would start with the list of WooCommerce hooks. I hope that helps! 🙂

    • I realize this an old thread but the following will remove the max price and display the min only.


      /**
      * Returns min price for variably priced products
      **/
      add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
      function custom_variation_price( $price, $product ) {
      $price = '';
      $price .= woocommerce_price($product->min_variation_price);
      return $price;
      }

      • This is awesome John! Thanks for sharing! 😀

      • Hi John,

        Thanks for this code; it’s a big help. Could it be adapted to show the min original price and sale price?

      • Hi
        I used John’s code snippet to display the minimum price for my shop products.

        /**
        * Returns min price for variably priced products
        **/
        add_filter(‘woocommerce_variable_price_html’, ‘custom_variation_price’, 10, 2);
        function custom_variation_price( $price, $product ) {
        $price = ”;
        $price .= woocommerce_price($product->min_variation_price);
        return $price;
        }

        But How do I prefix the minimum price so the word ‘From’ appears?
        Thanks!

      • Thanks, I want to display the min price but maintain the tax, because with this code its also hidden, how can I do this?

      • Awesome, thank you!

      • Hi John, i added your code above into Woocommerce code and it works great, Thank you so much. Great result.

        Stuart

      • Your comment is awaiting moderation.
        Hi John,

        Based on your super-awesome code snippet, is it possible to display the variation price that it is currently selected?

        Bill

  5. Hey guys,

    Thanks for your efforts here. Any idea how I can simply return the lowest price and possibly get the attribute that goes with it?

    I am working on a coffee roaster site. The bags are 1 lb. and 5 lbs. with separate prices. I would simply like the store page to show the first price and 1lb. (i.e. $16 / 1lb.)

    Any thoughts?

  6. You just saved my day 😉

    Thank you for sharing!

  7. Hi,
    This is just what I’m looking for, but sadly it’s not working for me.
    Does the plugin work with the latest version of woocommerce?
    Thanks.

    • WooCommerce 2.1 now displays variable prices like $x-y so this doesn’t work unless you’ve done your own custom programming to put the from price back in there. 🙂

      • Any way I can make this work with Woocommerce 2.1.6?
        Have you considered an update? Or maybe you can give me an idea on what to modify, I’m no coder but I know my way around code if that makes sense.

        • Sorry I should have been more clear before. WooCommerce 2.1 now displays the “From: $X” as “$X-Y”. This snippet now removes the “$X-Y”. I tested it myself this morning. If you’re still seeing the “$X-Y” then there’s something else going on with a theme or plugin.

  8. thanks for the plugin.
    unfort i have one more problem now.
    the “top products” element on other pages does not show any price now and there is a bad blank row now. can someone help?
    thanks 🙂

    • You’re correct this also affects the Top Rated Products widget which some people may want. You’d want to write in some extra functionality that checks to make sure this is the main query. There is a useful WordPress function called is_main_query() that you may want to look into. It will be more than a one or two line change to get it to work you may need to hire a developer to get it to work for your exact use case.

  9. Hello,

    I tried your plugin and it worked indeed, but I want to go a step further and show the default variable price in the shop instead of nothing. Is this also possible?

    So, with the plugin I disabled the $x-y price, but I want to show the price of the default variation. Is there an easy code for it?

    Thanks

  10. thanks patrick for ur fast reply.
    hire a developer doesnt seem a good solution for me ^^

    there must be a solution that if the price could not be hided properly everywhere, then the $x-z should be changed to: From Min$

    is that possible?
    thanks in advance 🙂 greetings from germany

  11. tims solution with the variable price is also fine for me.
    how could this (or my idea) be done?

  12. how to modify or edit or replace the price labels, on the front-end, rather just display the product as it is & the product show prices only when the options(attributes & variables) are selected

    For example one of my product selling :Stay 2nighs @Hotel Dolphin costs $500 & the maximum bookings we are accepting is 10, so the max value of this product is $500*10=$5000, flat 10% discount also applied. On the front end of the list of products it is displayed as:
    Stay 2nighs @Hotel Dolphi
    $500 – $5000

    the single product page also displays same content:
    Stay 2nighs @Hotel Dolphi
    $500 – $5000

    Now, I want to modify these labels to show only the starting(min) price but not the max price

    Another ex: Hollywood Day Tour

    $150 – is per 1 Person
    $1200/- – is when 10 persons & 10 Children visit it

    but displaying the ‘min price’ & ‘max price’ at a time, misleads the customer in a way the user ignores the package assuming its very costly. So, I want to place only the starting price(min price, ie: $150) not the max. So, please let me know how can we modify this, so only min price is displayed..

    Thanks & look forward..

  13. Hi there!
    You say that there’s a gotcha here with this plugin and to overcome it I would have to modify this filter to check to see if the prices are different and then return an empty string…
    How exactly should I do this? I can’t seem to figure this out…

    Would be very nice if someone lend me a helping hand with this.

    • Unfortunately I don’t know exactly how to do it. You’d have to add some extra logic in there that checks for identical prices. What I would recommend is getting a developer to look into this for you for an hour or two to find out exactly how to do it. If you do this please do share the updated snippet here! 🙂

      I’ve heard good things about the developers at Codeable who specialize in tweaks like this.

  14. I just make a difference on the return and i get the minimum price with “from” before and “€ vat included” after the minimum price

    you can see it at http://micasasana.com/tienda-on-line/

    return ‘desde ‘.$product->min_variation_price.’€ IVA incluido’;


    function patricks_custom_variation_price( $price, $product ) {
    $target_product_types = array(
    'variable'
    );
    if ( in_array ( $product->product_type, $target_product_types ) ) {
    // if variable product return and empty string
    return 'desde '.$product->min_variation_price.' € IVA incluido';
    }
    // return normal price
    return $price;
    }
    add_filter('woocommerce_get_price_html', 'patricks_custom_variation_price', 10, 2);

  15. Hello!

    I would like the variable products to show only the lowest price. In sale prices the same. Not a price range from-to.

    Can you, please, help me with that?

    Thank you in advance!

  16. The plugin works well in removing the range pricing. However, if you have an item that has variations but all pricing is the same. For example, color is the variation on a tshirt (black and white are both 19.99). Then the plugin removes the price completely and there is no way to view the item price.

    Any chance you can resolve this? Ive spent a couple of hours searching online for a solution and yours is the closest.

  17. Good Afternoon, I am testing a copy of the new WooThemes Bookings plugin but can’t seem to have it display a sale price the same way as simple products do.

    Is this something that these filters would be able to hook into?

    Cheers

    Paul

  18. I create 1 attribute size for my product, there are 3 variants are big: 15$, medium: 13$, small: 11$. But when displaying the products in the shop it displays the minimum price 11$ . I want it to display maximum of 15$ . Please help me!!!

    • Hey Tathuy,

      That’s a totally different customization. I’m someone at Codeable could help you with this (and not for very much).

      • Good Afternoon,
        I had same request but for the bookings plugin where have adult and child price.

        This is how solved it to show Adult price (eg max price)

        To change the ‘From: Price’ that is show for variable booking items to show From: Highest Price instead of the lowest these variable products are bookings using the ‘has persons’ toggle.

        The file that calls these is in the includes/class-wc-product-booking.php areas for reference and the exact ‘has_persons’ function below.

        This is the section:
        Line: 94 – 124:
        /**
        * The base cost will either be the ‘base’ cost or the base cost + cheapest resource
        * @return string
        */
        public function get_base_cost() {
        $base = $this->wc_booking_base_cost + $this->wc_booking_cost;
        ………………
        if ( $this->has_persons() && $this->has_person_types() ) {
        $persons = $this->get_person_types();
        $cheapest = null;
        foreach ( $persons as $person ) {
        if ( is_null( $cheapest ) || $person->cost cost;
        }
        }
        ———————————————-

        Just have to change the person->cost This way loop will over right the smaller price.

        Don’t usually like to edit main plugin files but until there is a hook added that can use instead. This is the way it goes.

        Cheers

        Paul

  19. Sorry I’m new at WordPress. Do I download the plugin (I can’t see any download) or do I copy and paste the code somewhere? If so, where?

    • Hi Marge, that’s no problem. You could click through to the gist page which allows you to download it, or you can follow this link. Then click the download button, unzip the file, and upload it to your plugins folder.

      I hope that helps! 🙂

    • Queenb123, You can

      1. go to the wordpress administration panel
      2. Click on Plugins
      3. Click Editor
      4. Select plugin to edit : WooCommerce
      5. You can just copy and paste the code without the “<?php" to the bottom of woocommerce.php

      That's a quick way to make the code above work on your woocommerce. For newer versions of woocommerce (2.2+), you want to use this code to remove the price range. With this snippet, instead of showing up like "$1 – $10", it'll show up as "Only $1"


      function spoofee_custom_variation_price( $price, $product ) {
      $target_product_types = array('variable');
      if ( in_array ( $product->product_type, $target_product_types ) ) {
      return 'Only '.$product->min_variation_price;
      }
      return $price;
      }
      add_filter('woocommerce_get_price_html','spoofee_custom_variation_price', 10, 2);

  20. Hi, thank you so much for this. I installed the plugin and added John’s code and while it works perfect on the product page, the main shop page (catalog) doesn’t display the price. Any idea what might cause this or how to fix it?

  21. Hi, it’s possible to do this only in the product variable page? when i click on the product page, hidden the variable price, it’s possible?

  22. Thank you @patrick for your efforts, read all thread with comments below,
    You saved my day !!
    @kenji4861 Thanks for quick snippet that works with current version.

  23. Patrick, I wish all plugins worked as smooth as yours.

    Plug-N-Pay literally!

    Great job mate, cheers from Florida, USA.

  24. Thanks for this great code. Is it possible to only remove the price range on the actual product page? So that when you view the categories, the price range will still appear there.

  25. Life saver, had this issue for a while but did the trick thank you

  26. Still trying to remove the “from” from all my “bookable” products. Tried replacing ‘variable’ with ‘bookable’ in the code…. didn’t work…

    All oiur prices are a single, fixed price and for a week the “From” was not there, suddenly it just showed up on all our products.

    Thanks in advance!

    • When the Bookable Product is set to virtual only, then the From disappears, when I also click on “Has Persons” that triggers the ‘From’ showing up on the product price.

      Thanks

  27. Seems this no longer works any chance on an update?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.