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 writing 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 yearlyDo you prefer using cryptocurrency? I’ve got you covered! You can donate at the following wallets:
- BTC: bc1q87nxpdpqw323ccmerrzyeffs72wnxpw93x7pzk / 17Gtc5e8yoh2LZzokoyK8P5DWbToBwztok
- ETH: 0xA5C89Be1df2896C3942DBEf751cCeacC7929388b
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!
Hi,
i just wrote a new article for this. Please check: https://nicolamustone.it/2015/02/27/hide-ninja-forms-add-ons-prices-in-the-cart-and-checkout-pages/
Thank you so much man! you are genius!
Hi Nicola,
I included the code in function.php but showing the $0.00 in the checkout table? Any thought?
Regards
S
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?
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
Hi Mike,
the add-on slug is the value of the Name field but all lowercase and with dashes instead of spaces.
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.
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.
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?
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
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
Hi!
Help me! How to hide a specific payment method in the checkout page?