Posted on

Disable Grouped Product Price Range $$$-$$$ | WooCommerce

You may want to disable the Grouped product price range on the Shop and Single Product page. This usually looks like $100-$999. With this snippet you will be able to display “From: ” in front of the minimum price, or otherwise completely hide it ๐Ÿ™‚

Change the display of price range for Grouped Products

PHP Snippet #1: Change WooCommerce Grouped Product Price Range Format $$$-$$$


/**
 * @snippet       Change Grouped Product Price Range
 * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @sourcecode    https://businessbloomer.com/?p=22191
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 3.4.1
 */

add_filter( 'woocommerce_grouped_price_html', 'bbloomer_grouped_price_range_from', 10, 3 );

function bbloomer_grouped_price_range_from( $price, $product, $child_prices ) {
$prices = array( min( $child_prices ), max( $child_prices ) );
$price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
return $price;
}

PHP Snippet #2: Remove WooCommerce Grouped Product Price Range Entirely $$$-$$$


/**
 * @snippet       Remove Grouped Product Price Range
 * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @sourcecode    https://businessbloomer.com/?p=22191
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.0.4
 */

add_filter( 'woocommerce_grouped_price_html', 'bbloomer_grouped_price_range_delete', 10, 3 );

function bbloomer_grouped_price_range_delete( $price, $product, $child_prices ) {
$price = '';
return $price;
}

Where to add this code?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such delicate files - if you need more guidance, please take a look at my free WooCommerce Customization video tutorial.

Does this snippet still work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free videos, tutorials and tips!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP
  • woocommerce-customize-shop-page-PHP
  • woocommerce-advanced-customization
  • how-to-edit-woocommerce-cart
  • woocommerce-customize-checkout-page-PHP
  • woocommerce-email-customization
  • woocommerce-conditional-logic

Rodolfo Melogli

Author, WooCommerce expert, WordCamp speaker and Internet marketer, Rodolfo Melogli has worked as a WooCommerce freelancer since 2011. He helps entrepreneurs and developers overcome their WooCommerce nightmares :) Rodolfo is the organiser of WordCamp Dublin, the Dublin WooCommerce Meetup, the Dublin Ecommerce Meetup and the Dublin WordPress Meetup. He enjoys interacting with people, travelling and chasing tennis & soccer balls. Of course, he loves pizza too.

36 thoughts on “Disable Grouped Product Price Range $$$-$$$ | WooCommerce

  1. I’m on WooCommerce 3.4.2 / WP 4.9.6 and PHP 7 โ€“ it doesn’t work for me. May someone confirm?

    1. Still works Fabio ๐Ÿ™‚

  2. Hi,
    Is this tested with 3.4.1 ?
    Thanks

    1. Yep Rojo, just tried it on WooCommerce 3.4.1 and it still works ๐Ÿ™‚

  3. its not working

    1. Hey Dante, thank you so much for your comment! I’m afraid it does work on WooCommerce 3.3.4 so you must have some other problem. Let me know ๐Ÿ™‚

  4. Hello

    Thanks for the snippet. Could you get Woocommerce to show “to price” instead of “from price” ? Just to display the highest price.

    //Ken

    1. Hey Ken, thank you so much for your comment! Yes, sure, you just need to slightly edit this snippet ๐Ÿ™‚

  5. Hi

    Not working now after Woo update to 3.3.1. Tried with TwentyFifteen them too and no joy !

    Thanks

    1. Not sure Danny ๐Ÿ™

  6. Seems broken now with latest Woo

    1. Hey Danny, thanks for your comment! I just tested this again with 3.3.1 and it works perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet?

      Also, take a look at this tutorial to see how to troubleshoot: https://businessbloomer.com/woocommerce-troubleshooting-mistakes-to-avoid/

      Finally, can you try switching temporarily to “Twentyseventeen” or “Storefront” theme and let me know if it works?

      Hope this helps!

      R

    2. Hi Rodolfo just had some time to revisit this now. I think its probably to do with the fact that I’m using a divi theme shop module and so the code does not apply – I suspect the ‘woocommerce_grouped_price_html’ bit !! ๐Ÿ™‚

      Is there a way of altering the code to apply to this page/template? Your help much appreciated

      Many thanks ๐Ÿ™‚

    3. Hey Danny, thanks so much for your comment! If my snippet work with another theme, then yes, it might be Divi or another plugin that are causing problems. Did you ask Divi for support?

  7. Hi Sir,

    How to work this in product page only, do have any code snippet for this? ๐Ÿ™‚

    Thank you!

    1. Hey Val, thanks for your comment! I suggest you take a look at “conditional logic”: https://businessbloomer.com/conditional-logic-woocommerce-tutorial/ and https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/. Let me know ๐Ÿ™‚

  8. Worked for me. Thank you.

  9. Works perfectly !! Thanks

    1. Thank you Miki ๐Ÿ™‚

  10. Hi
    This is working but i want to remove only First Price like ($$$-$$$) in this i want only first price not all.
    thanks for help

    1. Sorry Malik, this is not clear to me. Can you link to a screenshot so I can understand if this is a bug or not? Cheers

  11. thank you, Rodolfo

    the code worked like a charm for me. pasted the code in functions.php in child theme

    1. Excellent, thank you Jagan!

  12. Thank you!

    1. No… thank YOU! ๐Ÿ™‚

  13. This is not working for me, but I have no grouped products, I am using variable products, so I tweaked the snippet, but now the prices show as โ‚ฌ0!!! When I select all the options/variables of the product it gives me a final price, but I would like it to show “from โ‚ฌxxx” xxx being the minimum possible spend…

    1. Thank you so much!! ๐Ÿ™‚ However it still removes the prices on everything that has variable pricing, until selecting the variables and then only shows a small price near “add to cart” button… ?

    2. Hey Reese, is this referring to the variable snippet? If yes please re-post the comment there ๐Ÿ™‚

  14. Hi Rodolo – this is nearly exactly what I’m after. I only want to show the price of the FIRST of the child products on single and category pages. This will also be the

    max( $child_prices ) 

    . Have tried to hack your code but without any luck – do you know if this is possible. Am working localhost so can’t show.

    1. Renee, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here on the blog. I would recommend taking a look at what’s inside $child_prices to see if you can grab the first element of the array ๐Ÿ™‚ Thanks a lot! ~R

  15. Hi Rodolfo,

    Thanks for the article. It’s also not working for me sadly, I have tried both snippets in my functions.php file in my child theme and it nothing changes. The price just show the samething on both the product page and any other page you can view the product (e.g. search, homepage etc..). Price remains the same format like this: “$8.59 โ€“ $9.82”

    Any ideas? Thanks

    1. John, thanks for your comment! It works on my Storefront test website, so maybe this is something related to your theme and/or plugins. If you disable everything but WooCommerce and switch theme, does this work?

  16. this snippet (nr1) doesnt work for me ๐Ÿ™

    1. Thanks for your comment Demian! What doesn’t work – do you get an error? Can you provide a screenshot? Cheers ๐Ÿ™‚

Questions? Feedback? Support? Leave your Comment Now!
If you're writing code, please wrap it between: [php] code_here [/php]

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.