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;
}
Share Article

Related Articles

WooCommerce

WooCommerce Analytics

Tools + Resources

The Best 7 Logo Design Trends of the Year

Google’s March 2024 Core Update: Squashing AI-generated Spam

SMMA Podcast Releases Exciting New Episode Featuring Peter Vigilante, President of Vigilante Marketing

How to Win the Name Game: Choosing an Effective Company Name

Black History Month: How People Of Colour Changed the Marketing Landscape

Launching a Small Business in Your Local Community

YouTube Channel: 5 Tips for Getting Started

3 Easy Ways to Power Up SEO for eCommerce Product Pages in 2022

10+ Best Wishlist Plugins for WooCommerce 2022

Business Excellence Awards Winner

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.

Website development post-launch support and resources
Secret Link
SHARE YOUR CART