Nicola Mustone

Happiness Lead @ Automattic



Hide add-ons cost on the checkout page

With WooCommerce you are free to add as many fees as you need to your orders. There are various ways to do that, like payment gateways or proper extensions to up-sell on the checkout page.

One of these extension is WooCommerce Checkout Add-ons. It’s a great tool to create checkout fields which can be both free or paid.

In the case they are paid, there’s not any problem. The fee will be included in the order review table before to checkout. The same happens with free add-ons. This means that you will see the fee in the review table and it’s price like $0.00.

This is not always the best thing. They are free, why should i show a cost? With a PHP snippet you can remove the cost only for free add-ons.

Open your functions.php file located in wp-content/themes/your-theme-name/ and add this code at the end of it:

 

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!

One-Time
Monthly
Yearly

Make a one-time donation

Make a monthly donation

Make a yearly donation

Choose an amount

€1.00
€5.00
€10.00
€5.00
€15.00
€100.00
€5.00
€15.00
€100.00

Or enter a custom amount


Your contribution is appreciated.

Your contribution is appreciated.

Your contribution is appreciated.

DonateDonate monthlyDonate yearly

Subscribe to This Blog

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

Join 669 other subscribers

13 responses to “Hide add-ons cost on the checkout page”

  1. Hi Nicola,
    I have the same problem with Ninja form add-on. It shows price ($0.00) after add on item, how can I hide it? I have try to and ninja form at:
    $hide_for = array(
    ‘add-on-slug’,
    ‘ninja-form’,
    // Add here as many add-ons as you need
    );
    but it’s not working. Can you help me? Thank you!

      1. Thank you so much man! you are genius!

  2. Hi Nicola,
    I included the code in function.php but showing the $0.00 in the checkout table? Any thought?

    Regards
    S

  3. Dropped in the script but not working…. I have an add-on with the name marketing that I want to hide, but when I replace ‘add-on-slug’ with ‘marketing’ in the script it still shows up on the checkout page. Is marketing the actual slug of the add-on?

  4. bump ^^^
    How do you find the slug for the add-on? I’ve looked through the database and there is only “_wc_checkout_add_on_id” which does not work

    1. Hi Mike,
      the add-on slug is the value of the Name field but all lowercase and with dashes instead of spaces.

  5. Hello Nicola,

    I tried several times but I could not. Is slug instead of name value added is exactly what will be included in the page manager. My English is not very good level. Can you help me?

    Best Regards.

    1. Hi Menderes,
      I’m not really sure to understand what you wrote, I’m sorry.

      The slug is usually exactly like the title, but all lowercase and with dashes instead of spaces.

  6. I seem to be having a similar issue. Just want to confirm that if the name of my add on is “Are you a new donor?” that the slug would be ‘are-you-a-new-donor’. This isn’t working as I still see the name and 0.00 fee in the order summary. Thoughts?

  7. I want to hide some field that I’ve created by “WooCommerce Checkout Add-Ons” Plugin

    Is there any way to do this?

    https://i.imgur.com/YRlzfZE.jpg

  8. Hi Nicola,
    Thanks for posting this article. I’d really love some extra help for myself and future people reading this so hope you can help.

    I have a text field with a text title of
    Add message: [input]

    I’ve added your code verbatum changing ‘add-on-slug’ to be ‘add-message’, I’ve also tried adding different strings here from the input name in the source code but nothing seems to work.

    Any idea what is wrong here?

    Thanks

  9. Hi!
    Help me! How to hide a specific payment method in the checkout page?

Leave a Reply

You Might Also Like These Articles


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!

One-Time
Monthly
Yearly

Make a one-time donation

Make a monthly donation

Make a yearly donation

Choose an amount

€1.00
€5.00
€10.00
€5.00
€15.00
€100.00
€5.00
€15.00
€100.00

Or enter a custom amount


Your contribution is appreciated.

Your contribution is appreciated.

Your contribution is appreciated.

DonateDonate monthlyDonate yearly

Don't Miss a Thing!

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Join 669 other subscribers

Continue Reading

Discover more from Nicola Mustone

Subscribe now to keep reading and get access to the full archive.

Continue reading