How to Change the Variable Product Price Range in WooCommerce

If your variable product has a range of prices for it’s variations, then WooCommerce will display this as ( for example):

$12.99 - $30.99

Sometimes, this is less than ideal. Fortunately, it’s simple enough to change this to the following format:

From: $12.99

If you’re not sure where to put this code, you can try using the Code Snippets plugin, or add it to your theme or child theme’s functions.php file.

You can easily change the “From: ” prefix by modifying the $prefix variable in the function. To remove it completely, just change it to $prefix = '';

Want to take this a step further?

Try the 14-day free trial of WooCommerce Show Single Variations and display product variations in your WooCommerce shop pages as though they were simple products.

Get Free Trial


  1. Ivy K. says:

    I added this code and my whole website is blank now.

    It’s certainly done!

  2. jh. says:

    Maybe you copied the code from IE Edge. Open this site with Firefox to copy the code.

  3. Erik says:

    This is exactly what I was looking for, Thanks! But when added the code in my child themes function.php the price looks like this: “From: 116,118kr0kr”. Any suggestions?

  4. Mireille says:

    Is it possible to make the “from” smaller than the price and a different color?

    • James Kemp says:

      Definitely! You could do it with inline CSS, or better yet, add a class to the from text:

      $prefix = sprintf(‘%s: ‘, __(‘From’, ‘iconic’));

      then use CSS like so:

      .iconic-from-label {
      font-size: 12px;
      color: #ccc;

  5. Narelle Eustace Holly says:

    Using woocommerce currency switcher, the pricing shows 0.00 when using another currency other than the base currency???

    Anyway of fixing this???

  6. Concerned Citizen says:

    Thanks for this. Needed the opposite numbers (max vs min) and this did the trick.

  7. Janke says:

    Thank you for the snippet. Is there a way to modify it s it could
    also show price without tax? I have set it up in Woocommerce >>
    Settings >> Taxes >> Suffixes and for the simple products it
    shows well but for the price in this snippet unfortunately not. Do you have some handy idea how to modify your original snippet to show this suffix?

  8. Michael says:

    Thank you for the snippet, works just fine.
    Could you please advice on how to make prefix to be the same style with the digits? Prefix now is outside that span class.

    • James Kemp says:

      Hey, you’d be best off wrapping the output in another container, as it’ll be hard to reliably get it into the price span.

  9. Elizabeth Drew says:

    Another great snippet 🙂 This is a goldmine!

  10. Capucine Roussel says:

    I wanted to know how to make this work with your plugin Show Single Variations. At the moment, on the category page the “From : xxx” appears under the original variable product but under the variations, the price of that specific variation appears. I would like the same “From : xxx” to appear under each variation. Can you help?
    Just updating my comment as it seems to be pushed down the page by older posts… Any chance you could look into this? Thanks

  11. Barry Johnson says:

    I added this and it blew up my site. WHERE in the functions.php should it be entered please?

  12. Gudmundur Orn Isfeld says:

    Hey thanks for the snippet! It is the only one that works with currency converter that I have tried!
    My price is showing with a line crossed over it, do you have any idea how to fix that or what it might be?
    Thanks again!!! https://uploads.disquscdn.c

  13. Chris Wingfield says:

    Is this still working for people ? As I’ve added it and I still have the same issue. Many Thanks is advance. PS Flatsome Theme. https://uploads.disquscdn.c

    • James Kemp says:

      Hey Chris,

      I just tested with Flatsome 3 and it still appears to be working. Have you tried disabling other plugins to see if there’s a conflict somewhere?

  14. Peter says:


    awesome . But i have a question. On my website also the price per gramm is shown. Like: 12,99 Euro-13,99Euro / kg
    How can i edit this so it is also shown like: from 12,99 /kg?

    you have a idea?

    Thank you very much

  15. Bruno Antunes says:

    Savior ! 🙂

  16. Jamie says:

    This code works great! One thing I’m trying to modify that I just cant quite get is I would like this to only happen on the shop and category pages. Then display regularly with the min and max on the single product pages. Is there a simple way to make that happen within the function?


  17. Thomas Strunk says:

    Wow that worked like a charm! Thank you so much! Do you know how to remove the cents part? Like to have it show only $45 instead of $45.00 ? All of the prices are an even dollar amount without any $44.99 cents or anything like that on the site, so it does not look as clean with the .00 after all of them 😉 They where not on there before so I am guessing there is some part of that code I need to tweak to not have it add that back on there 😉 If you can let me know what part to change or add that would be AWESOME! Thank you so much!

  18. Bence Takács says:

    Displayed correctly on Product Category Pages but on Product Page (if it has variations and it is on-sale) one can see two different prices being displayed: one for the selected variant and one which is the output of the script above.

    I can fix that with the following css hack:

    div.product-type-variable > div.entry-summary > p.price {
    display: none;

    • James Kemp says:

      Yes, but once a variation is selected the price is no longer “From”?

      • Bence Takács says:

        That’s right: now on the Product Category page I can see the “From:” and inside the product I can see the price only for the selected variation (I set defaults for not having an ’empty’ price field). So everything is nice and dandy 🙂

        (You can see the two-price displayed here:… one below the “Product Title” and one below “woocommerce_single_variation” field. I disabled the first one with the css)

        I’m wondering how could I achieve the same goal with modification only in php: is there a way to not display the price under ‘product title’ in case we are on a ‘product page’ and product type is ‘variable’…

  19. Rusty Talent says:


  20. Igor Dovečer says:

    Is it possible to update this plugin to only show min prices of available variable products (if variable product stock quantity is >0, otherwise ignore it).

  21. Lorraine Glanz says:

    I’m battling to customize my WooCommerce site. I struggled with the issue of only showing the lowest price on variable products.
    The plugins and other posts have the irritating “from” text before the price, which is just not acceptable to me.
    Your post was the first one I came across that dealt with this “from” issue.
    Thank you very much. It worked for me.

  22. dzulfriday says:

    Most of my product only has 2 variants. What if I don’t want to show it differently? Instead of show it like “From: XXX”, I want to show it like this:
    – Variant A: $XX.XX
    – Variant B: $XX.XX

    I don’t want my customers need to use the variant drop down first just to know the price.

  23. Line says:

    Thank you sooo MUCH

  24. Veronica says:

    Thank you! Thank you! Thank you!

  25. Coach says:

    Hi there. Thanks for the code. Works well on my variable product. Is it possible to achieve this “From:” pricing for Grouped product that has simple products linked to it?

    • Mohsen says:

      thank you
      I’m looking for a way to show the price of my variable products ” from $ – to $ ” show, not as a straight line, but I do not know what to do.
      Thanks for advising me.

    • Mohsen says:

      I just want to add “from” and “to” with before the variable price product in this way: from $ – to $ for example : from 20$ to 30$

  26. Mohsen says:

    i want show varialbe price like this From $12.99 To $13

    how to show this item?

  27. Rocio says:

    Is there a way to show the Highest Price instead of the Range? For example a restaurant that sells half sizes as an option but wants the Full size to be shown first?

  28. Nate says:

    Nice snippet man. Thanks for posting.

    One note (Flatsome): if a variation is on sale the original price of the variable displays crossed out. Not necessarily a bad thing I guess.

    Also for wpml types you can translate ‘from’ here rather than in the translator.

    if(ICL_LANGUAGE_CODE==’en’) {

    $prefix = sprintf(‘%s: ‘, __(‘From’, ‘iconic’));


    $prefix = sprintf(‘%s: ‘, __(‘ab’, ‘iconic’));

  29. Will Shearer says:

    Hi, a bit late to the party, but can this be done for a single category? say you have a category of variable pricing where you want “price per person” (let’s call the category “Tours”) then have a category of “gift cards” or something else inanimate with a $prefix of “Prices From”?

  30. Bill says:

    Thanks, it worked but the suffix “+GST” disappears. Here in Australia we have GST tax, and on our store the prices are given GST exclusive, so we put “+GST” on the end of price. Your script works, but causes the suffix to disappear, can you help a noob out with how to make sure the suffix stays in place after the price?

  31. Chris P says:

    Awsome mate, finally got a solutio for this. I’ve spend hours looking at various plugins and themes hoping to find one which will do the trick. Turns out I just needed the little snippet of code you provided above!

  32. roberta says:

    not works if I use dynamic pricing

    • James Kemp says:

      Yes, you might need some additional code to get it working with a plugin like that. i’d assume they have their own way of doing it.

  33. Shaq says:

    Thanks for this, this works great – is there any way to remove the colon after the ‘from’.

    I would prefer it was just ‘From £123’, rather than ‘From: £123’.

    • James Kemp says:

      Hey Shaq, you can just change line 9 from:

      $prefix = sprintf(‘%s: ‘, __(‘From’, ‘iconic’));


      $prefix = sprintf(‘%s ‘, __(‘From’, ‘iconic’));

      Hope this helps!

  34. Steve says:

    Hi !

    I would like to display range price instead of regular price only if range price is available.

    Any idea ?


    • jalil says:

      yes, its by default available in woocommerce. if you add Single Product it will show regular price and if you add as Variable Product it will show price as price range

  35. Moises says:

    In a recent update it stopped showing in some products… any idea? I haven’t been able to find a reason why it shows in some and not in others.

    • Moises says:

      So far I found a fix… but it means going through all the products… if I go into the variations and make a change (anything at all) and save them, something gets updated that makes it work again.

      I dont know if there was a recent change on a WooCommerce function os data structure related to variations but this is makeing it work again.

  36. leila says:

    Thanks for this,I want show custom price select in variable section rather than min price. how can edit code?

Leave a Reply

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