Nicola Mustone

Happiness Lead @ Automattic

Hide the Ninja Forms Add-ons’ prices in the cart and checkout pages

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.



Subscribe to This Blog

Receive new articles from this blog directly in your inbox! No spam guaranteed!

Join 651 other subscribers

Contribute to Improving This Blog

Did you enjoy this article? Was it helpful? Contribute to help me write more articles! The funds collected from this blog are reinvested directly into improving my skills or the blog so that I can provide more and better content!


Make a one-time donation

Make a monthly donation

Make a yearly donation

Choose an amount


Or enter a custom amount

Your contribution is appreciated.

Your contribution is appreciated.

Your contribution is appreciated.

DonateDonate monthlyDonate yearly

More Posts That You Might Like…

9 responses to “Hide the Ninja Forms Add-ons’ prices in the cart and checkout pages”

  1. This worked a treat. Thanks. Made the mistake of pasting the code outside the closing PHP tag to start with, what a numpty!

    1. Hi Michael,
      thanks for writing!

      Glad you like the tutorial and that you found the closing tag issue! It happens to everyone, no worries 🙂

  2. Thanks for this code!

    I am having a couple of issues though,

    1) I had to remove the first and last “/” to get it to work (I don’t know why – nobody else mentioned having to do that).

    2) After I pay and get my woocom emails, they don’t have any of the data that was related to the field.
    Also, the woocommerce order doesn’t have the data either. The ninja form does, but the customer gets an email that looks as though they left all their fields blank.

    For example, if the form had a “First name” field the normal output is this:
    First Name: Peter ($0.00)
    After using your code the output SHOULD be:
    First Name: Peter
    but instead is:
    First Name:

    Anyone else having this issue?
    It’s weird because it works correctly when displaying the Cart, but everything else after the purchase is lacking all the data (except for the ninja form submission).

    1. Hi,
      a regular expression needs to have opening/closing characters, in this case those / were the opening/closing character, so you don’t have to remove them.

      For the other issue, please open a ticket here:


  3. I tried adding this to my functions an it doesn’t work. I submitted two tickets to WooCommerce over the last two days and haven’t received a response.

  4. Gday. This worked perfectly as-is. Simply dumped it in functions.php and away went those nasty $0.00s. Any thoughts how I can remove fields that are not completed by customers. No point in those fields appearing either (if there’s no user data in it). This would make the checkout summary & customer order much cleaner. Thanks a ton!

  5. Hi Nicola

    This code looks awesome and seems to be exactly what some people are looking for.

    Unfortunately, I am looking for a simple modification of the above.

    At we have a long form with 4 parts.

    99% of the fields are just something I need in order to prepare some legal documents, not something the customer wants to look at again before checking out.

    So, I was thinking, is it possible to simply remove the free fields with input and price and everything from the checkout page?

    Hope its possible to find a simple solution that also works.

    Thanks, looking forward to hear from you.



    1. Did you ever get that figured out?

      1. No I didn’t, but a bad fix that works for now, is just removing all ninja forms input in the checkout and thank you table:

        /* Should hide all NinjaForms Fields from Checkout Page*/
        .woocommerce form.checkout table.shop_table .variation{
        display: none;

        /* Hide the variaton from the Thank You Page*/
        .woocommerce-checkout table.shop_table .variation{
        display: none;

        Customers still get a really ugly email though, thats for sure – no body have a fix that could work for the above?

Leave a Reply




Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Join 651 other subscribers

About The Author

Hi, I’m Nico! Support Lead at Automattic, championing & WooCommerce. Off-duty, I’m at Elemental Beacon, leading epic D&D adventures. Let’s connect, whether it’s about WordPress or a quest!


Don't Miss a Thing!

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Join 651 other subscribers

Continue Reading

%d bloggers like this: