November 6, 2023

Change $0.00 to show “Free” at WooCommerce Products with Code Snippets

Play Video

When you list products on your WooCommerce store, showing a price of $0.00 might not be the most effective way to communicate value to your customers. Instead, displaying the term “Free” can be more appealing and clearer. This tutorial will walk you through the process of using a code snippet to make this change.


Prerequisites

Please make sure you have the following installed and activated:


To change the display from $0.00 to “Free” on your WooCommerce products, follow these steps:

  1. Navigate to Snippets > Add New and name it “Set 0 Prices to be Free”.
  2. Copy the code:
    /**
     * Snippet Name:	WooCommerce Change "$0.00" to "Free"
     * Snippet Author:	ecommercehints.com
     */
    
    add_filter( 'woocommerce_get_price_html', 'ecommercehints_change_zero_price_display', 10, 2 );
    function ecommercehints_change_zero_price_display( $price, $product ) {
    if (empty($product->get_price()) || $product->get_price() == 0) { // If price is not entered or set to 0
    $price = __( 'Free', 'woocommerce' );
    }
    return $price;
    }

    Source: Code Snippets

  3. Paste the code into the new snippet area.
    Paste the code into the new snippet area
  4. Save changes and activate the snippet.

Once activated, any product priced at $0.00 will now display as “Free”. If you prefer a different term, such as “Free Product”, you can modify the code snippet accordingly.

Any product priced at $0.00 will now display as "Free"


Conclusion

With a simple code snippet, you can enhance the customer experience by clearly indicating when a product is available for free. This small change can make a significant difference in how customers perceive the value you’re offering.

Required Resources

WooCommerce Logo
Free Options
Code Snippets Logo
Free Options
Credit to Web Squadron
Web Squadron is a popular YouTube channel dedicated to providing informative tutorials, tips, and insights on web development and design. With a strong focus on WordPress and website builders like Bricks Builder, the channel aims to help users of all skill levels, from beginners to advanced developers, create and optimize their websites. By offering easy-to-understand, step-by-step guidance, Web Squadron provides practical and valuable content.
Visit
Change $0.00 to show “Free” at WooCommerce Products with Code Snippets
Welcome back!
Enter your Helwp credentials to sign in.

No Account yet? Sign Up

My Account
Menu
Give Feedback
Describe your feedback *
Rate Helwp
Share
Facebook
Twitter
LinkedIn
Reddit
Email
WhatsApp
Telegram
Pocket
Report
Problem *
Describe the problem
Want us to reply?
Your E-Mail
Affiliate Disclosure

At Helwp, we’re committed to transparency and honesty. Therefore, we want to inform you that some of the links on our website are affiliate links. This means that, at no additional cost to you, we may earn a small commission if you click through and make a purchase.

We only promote products or services that we genuinely believe in. These affiliate commissions help us to maintain the website and continue to provide you with free, high-quality WordPress content.

If you are interested in how you can support us even further, check out our support page.