I’ve been asked to write this article to show you how to hide the prices added by Ninja Forms Product Add-ons in the variations table on the checkout and cart page.
This was quite hard (not the code, but the regular expression, i’m a bit noob with regular expressions) but funny!
I chose to hide them with regular expressions. Why?
Well, this code should work with any price format, so different currencies, different amounts, different decimal separators and different number of decimals. So the regular expressions is probably a good choice to match all of them an replace the total price string from the pages.
But now it’s time to show you what to do.
Open, as usual, the file functions.php located in wp-content/themes/your-theme-name/ and add this code at the end of the file:
The patter is explained in the code, it matches the whole amount between the parenthesis, but first removes the HTML added by the plugin.
Enjoy!
Leave a Reply