Image may be NSFW.
Clik here to view.If you are using WooCommerce (which has fast become my E-Commerce plugin of choice for WordPress), then sometimes you’ll run into the issue where you want to use the word “FREE” as the price when a product is $0.
I ran into this issue recently because I’ll probably be looking at including some free add-ons to ThirstyAffiliates eventually and wanted to make sure the templates would look proper when the price was set to 0.
I came up with this little snippet of code that you can just drop into your functions.php file in your theme. You’ll need WooCommerce installed as well, of course.
add_filter('woocommerce_free_price_html', 'changeFreePriceNotice', 10, 2); function changeFreePriceNotice($price, $product) { return 'FREE'; } |
Hope this helps if you’re looking to do the same and have your prices show as “FREE” instead of an ugly $0.