<?php
// output a message if the product price is nil
// add the code to functions.php of your child theme
add_filter('woocommerce_empty_price_html', 'nil_price_message');
function nil_price_message() {
return 'Coming soon';
}
Credit: https://gist.github.com/mikejolley/1597957
when I add the code it gives me an error of the php code. I have the boutique theme and I added it in the functions.php file. Even when I deleted the code it still gave me an error. I had to upload the original file again to fix the site. What can I do? thanks!
What error message do you see? If you’re adding the code after something else you may not need a second opening “<?php”. if you see a closing “?>” then you need an opening “<?php” before the code, otherwise not. If in doubt, paste the whole file here: http://phpcodechecker.com/ to check it.
Great!! That helped me check the code and I was able to correctly edit the code and now it works. You rock my friend! Thanks!!!
Good. Next… did you add the code to functions.php in your theme? This may be overwritten by your next theme update. The recommended way is to make a child theme:
http://codex.wordpress.org/Child_Themes
and add your custom code snippets to functions.php of your child theme. Leave functions.php of your parent theme unchanged, then it can be updated.