Follow me on social media:

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.

15 thoughts on “How To Change the Price Of $0 Items To ‘FREE’ In WooCommerce

  1. 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. 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

    1. 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. 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. 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?”

    1. 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. 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

    1. Hi Josh,

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

  6. Josh,

    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!

  7. 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.

  8. 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.

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

Leave a Reply

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