Have questions about paid ads, campaign optimisation, or platform features? Browse our knowledge base for step-by-step guides, FAQs, and expert insights to help you succeed.
How to Show Free instead of 0 dollars in WooCommerce
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;
}
Still haven’t found what you’re looking for?
Let us know and we’ll do our best to help out!