How to Show Free instead of 0 dollars in WooCommerce

Generic filters

It is possible to show the word “FREE” as the price instead of $0.00 in WooCommerce when the product is actually free.

Showing the word Free instead of $0.00 is more noticeable to users and less confusing especially when just want to add some free products or gifts for your customers to choose from.

All you need to do is add the following code snippet to your theme’s function.php file:

/**
* @snippet       Display FREE if Price Zero or Empty - WooCommerce Single Product
* @author        Vigilante Marketing
* @testedwith    WooCommerce 3.8
*/
  
add_filter( 'woocommerce_get_price_html', 'vm_price_free_zero_empty', 9999, 2 );
   
function vm_price_free_zero_empty( $price, $product ){
    if ( '' === $product->get_price() || 0 == $product->get_price() ) {
        $price = '<span class="woocommerce-Price-amount amount">FREE</span>';
    }  
    return $price;
}
Generic filters
Share Article

Related Articles

Tools + Resources

Social Media Image Sizes

Freelance Hourly Rate Calculator

Still haven’t found what you’re looking for?

Let us know and we’ll do our best to help out!

sit back and relax

We have monthly site maintenance options to ensure that your website is running smoothly.