WooCommerce display FREE if price is zero ($0.00) or not set

Do you need to replace the default WooCommerce pricing label for a free product? Perhaps you offer some, if not all, of your products at no cost. Instead of showing the default WooCommerce price label of $0.00, you want to show custom text, such as the word “FREE” or “Download Now”.

On Thenga’s website, we’ve done exactly that. A number of our WooCommerce plugins that are listed on our site are completely free to download and use. We really didn’t like showing a dollar value of zero and so we replaced it with the text “FREE”. It turns out, that it’s really simple to do in WooCommerce.

What is required is a quick filter to override the price of the product and replace it with the text of your choice.

Change A Free Product’s WooCommerce Price Label

Just copy and paste the following snippet in to your functions.php file and edit the label text as indicated in the snippet’s comment below.


 * Display "FREE" instead of $0 if the item is free.
 * @param string $price The current price label.
 * @param object $product The product object.
 * @return string
function thenga_price_override( $price, $product ) {
   if ( empty( $product->get_price() ) ) {
       * Replace the word "Free" with whatever text you would like. Also
       * remember to update the textdomain for translation if required.
      $price = __( 'FREE', 'textdomain' );

   return $price;
add_filter( 'woocommerce_get_price_html', 'thenga_price_override', 100, 2 );


Breaking it down, we’re just checking the price of the product to make sure that it is “empty” i.e. free, and then if it is, returning different label text which in the case above is the word “FREE”.

If the product is not free, then we don’t change anything and return the original price.

It’s as easy as that. Do let us know if you run in to any issues and we will try our best to help you out.

5 thoughts on “WooCommerce display FREE if price is zero ($0.00) or not set

  1. Thank you very much WP Geeks for the snippet!
    P.S.: please make sure to remove that “” at the end ?

  2. Thank you so much for this snippet, it is the only one I found that is ‘translation ready’ with the proper “__(” and text domain element. You saved my day!! Cheers!

  3. Thanks! It works perfectly. It’s a relief that it was this easy, thanks to you.

  4. Hey it’s not working on my store.I have also seen other code in the tutorial to change pricing on display https://www.cloudways.com/blog/change-woocommerce-price-display/ but still having an error. Can you please help me out?

    function cw_change_product_price_display( $price ) {
    $price .= ‘ At Each Item Product’;
    return $price;
    add_filter( ‘woocommerce_get_price_html’, ‘cw_change_product_price_display’ );
    add_filter( ‘woocommerce_cart_item_price’, ‘cw_change_product_price_display’ );

    1. Hi Alvina,

      It looks like you’re appending text after the price value, instead of replacing it. Is that your intention? I’m unable to support on another sites snippet, I recommend you use the snippet above.

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.