How To Change the Price Of $0 Items To ‘FREE’ In WooCommerce

WooCommerceIf you are using WooCommerce (which has fast become my E-Commerce plugin of choice for WordPress), then sometimes you’ll run into the issue where you want to use the word “FREE” as the price when a product is $0.

I ran into this issue recently because I’ll probably be looking at including some free add-ons to ThirstyAffiliates eventually and wanted to make sure the templates would look proper when the price was set to 0.

I came up with this little snippet of code that you can just drop into your functions.php file in your theme. You’ll need WooCommerce installed as well, of course.

add_filter('woocommerce_free_price_html', 'changeFreePriceNotice', 10, 2);
function changeFreePriceNotice($price, $product) {
	return 'FREE';

Hope this helps if you’re looking to do the same and have your prices show as “FREE” instead of an ugly $0.

Looking for a coding job? See our job listings page. Click here to view →

About Josh Kohlbach

Josh is a programmer, entrepreneur and the founder of Code My Own Road. He started this website to help programmers with business stuff and also to get things straight in his head. You can read more about Code My Own Road and Josh on the About page


15 Responses to How To Change the Price Of $0 Items To ‘FREE’ In WooCommerce

  1. Smittyhead July 17, 2013 at 6:24 pm #

    This is almost everything that I have been trying to find out how to do. The only thing else is that I need it to show up in all thumbnail views like the “related products” and “latest products” views.

    If you can help me with that, you will be my hero.

  2. Carsten August 27, 2013 at 1:06 am #

    Hello Josh,
    I have the following problem. I run a shop under WordPress with WooCommerce 2.0.13.
    I do not want the prices to be displayed from the start. If the “price” is not filled in by me, I get the message “FREE”. I want to avoid this message. I want that the field remains “empty” not even zero, nothing.. only empty. How do I do that?
    I use an additional plugin that allows the customer to enter his own price.
    i will be happy if you can help me

    • Josh Kohlbach August 27, 2013 at 8:14 am #

      Hey Carsten,

      Have you tried implementing the above code and just returning an empty string instead of the word FREE? It probably wouldn’t get rid of the element itself though so it depends on how you have styled the price with CSS as to if this is a workable solution for you.

  3. Nic December 12, 2013 at 7:55 pm #

    Thanks so much for this code. It worked brilliantly! So glad to have people like you around when I type my questions into Google 🙂

  4. Jimmy February 12, 2014 at 2:59 pm #

    Sweet! This works awesome. What if I wanted to display different “free” messages for different items? Say I wanted products a, b, and c to show “free” but products x, y, and z to show “no cost to you?”

    • Josh Kohlbach February 12, 2014 at 3:26 pm #

      You’d have to do it either by inspecting the product itself and checking it’s title/slug or, what I’d rather personally would be to use the product category which means you can assign a different free text to any category you like.

      This is completely untested but you could probably do something like:

      add_filter('woocommerce_free_price_html', 'changeFreePriceNotice', 10, 2);
      function changeFreePriceNotice($price, $product) {
      	$terms = get_the_terms( $product->ID, 'product_cat' );
      	$freetext = 'FREE';
      	// Check if appropriate product category
      	foreach ($terms as $term) {
      		if ((strcasecmp($term->slug,'my-cat-slug') == 0) {
      			$freetext = 'No cost to you!'
      	return $freetext;
  5. Tori Tran June 4, 2014 at 3:36 am #

    tks, it work.

  6. Mads December 13, 2014 at 8:24 am #

    Hi Josh

    I’ve searched all over the web and I’m using the plugin product add-on more as a variable, because I like the checkboxes better. I’ve set the regular price to 0 and added filter in functions.php to remove the “Free” price tag everywhere.

    Now my question is, if it is possible to show the first add-on’s price in the box on the category-page?

    I’m new into WP and codes, so I don’t now where to look up the right filter.

    Looking forward to your help. Best regards, Mads

    • Josh Kohlbach December 17, 2014 at 7:47 am #

      Hi Mads, you’d probably have to look at overriding the WooCommerce template for content-single.php (i think that’s what it is called from memory).

    • Mads December 17, 2014 at 9:37 pm #

      Hi Josh,

      Thanks I’ll look into that. Then I have to find the right filter for the product add-on Price 🙂

  7. Tim January 1, 2015 at 4:31 am #


    Thank you so much for this code. This is great. I actually used it to mark original works as SOLD just by changing the wording. That way, if a painting sells, I can just change the price to Zero and it gets marked as sold. (I also update it as out of stock, so no one will try to buy it – but I didn’t think this was clear enough on the front page)

    Thanks again, I really appreciate it!

  8. Peter December 8, 2015 at 8:20 pm #

    Worked great for me, using child theme functions.php. Thanks!

  9. TB December 17, 2015 at 6:56 am #

    This doesnt seem to work for variable products, only simple products. Do you know how to make it work for both? I am changing the “FREE” to something else but many of my products have multiple variations.

  10. Jenna December 21, 2015 at 5:00 am #

    How can I do something similar for wothemes booking extension?
    I would like to change the price that pops up under the calendar when you select your date and time to something like “We will call you to confirm” Your code didn’t seam to work for this.

    I would also like to change it on the cart page to the same.

    • Josh Kohlbach January 6, 2016 at 9:01 am #

      Hi Jenna, you might have to reach out to the Bookings extension people for that one, sorry!

Leave a Reply

Read more:
How To Remove Digg Digg From WooCommerce Products
How To Remove Digg Digg Floating Share Bar From WooCommerce Products

I love the Digg Digg social sharing plugin for WordPress and put it on just about every site that I...