WooCommerce functions add the shipping method label on the Cart totals, on the left hand side of the price. This ruins the price amounts alignment (subtotal, shipping, taxes, total) and many clients have asked me to remove it completely. Also, it could be that sometimes you don’t want to show the name of a shipping rate on the front-end. So, here’s how you do it!
PHP Snippet: Remove Non-free Shipping Rate Labels @ WooCommerce Cart & Checkout
For example these:
- 5 Day Delivery: €25.00
- Local pickup
- Free shipping
…will show as:
- €25.00
- Local pickup
- Free shipping
What the snippet does is that it goes looking for a “:” and remove that and whatever is before that. Paid shipping methods are always in the format “LABEL: COST” so this will leave out just the cost. For methods that are free, there is no “:” and therefore the string stays as it is.
/**
* @snippet Removes shipping method labels @ WooCommerce Cart / Checkout
* @how-to businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @testedwith WooCommerce 3.9
* @community https://businessbloomer.com/club/
*/
add_filter( 'woocommerce_cart_shipping_method_full_label', 'bbloomer_remove_shipping_label', 9999, 2 );
function bbloomer_remove_shipping_label( $label, $method ) {
$new_label = preg_replace( '/^.+:/', '', $label );
return $new_label;
}
I am trying to achieve the same with Woocommerce Subscriptions plugin, but I just cannot find appropriate hook! In “Recurring Totals” shipping is always “Shipping via SHIPPING LABEL”.
Any chance you have a solution for this? Thanks for all your help, your website is very useful!
Hello Milan, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Doesn’t work when a product has a shipping class with “0,00” – Instead it shows the label of the shipping method. Any ideas how to fix this?
Thank you!
Could you show me a screenshot please?
Hi, thanks for that. One question. How to remove a colon before the price? Thanks.
Hi Marek, this should remove the colon too
I just tried this and it works like a charm! Thanks so much for this 🙂
Nice!
Thanks a lot! This snippet still works and saved a lot of headaches!
Cool
thank you so much
you are welcome
thank you great
Cheers!
how can I remove it from order received page
Hi Mohammed, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Aloha, I have a strange request, I have two integrated APIs (plugins for fulfillment), which seem to be at a conflict. If an item is added from each fulfillment location the split seems to double down and mix up and post as Shipping, Shipping 2, Shipping 3, and Shipping 4. I would like to remove two of these shipping aspects.
such as when a tote bag and a latte mug are added in a single order.
Can you please help?
Hi Averianna, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi there, im looking for something similar, my “store pickup” option in configuration makes me select a cost, if i set it to “$0” then a label appears “store pickup – Free shipping!”. Do you know how can i remove that free shipping, its confusing!
Hello Ian! Can you set it to an “empty” value instead?
Výborně funguje pro mou změnu, děkuji! Děláš skvelou práci!
WordPress Verze 5.2.3 a WooCommerce Verze 3.7.0
Great!
want to remove
Shipping | Free shipping
is it possible?
Hello Rocky, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Thank you so much! 🙂
You’re welcome!
Hi!
Thank you for the code. I’m using WooCommerce 3.5.5.
If I use this code line, it works, but:
– if the shipping is cost free, the cost free label is also hidden and there is nothing in this line
– if the shipping costs ex. 5 USD, the shipping method label is hidden and the cost is showing up
Hey Frank, just retested and my “Free Shipping” and “Local Pickup” rates show correctly even if they are free. Try disabling all plugins and switch theme to see if something is interfering
Still works. How can I apply it to the woocommerce order emails as well?
Thanks for your comment Sergeh! You’ll need to find the filter that the order email template uses 🙂
Worked for me 🙂
Thank you very much!
Excellent 🙂
This should go into the plugins folder, in a new folder (remove-shipping-labels) and a new file /remove-shipping-labels.php) unless you only want to apply this to your current theme
Casper, thanks for your comment 🙂 I definitely don’t recommend that though!
Seems to do the job for me too. Thanks a lot, really haven’t found any other solution that is working (->senseless feature from the plugin by the way)!
Great, thanks Anna 🙂
I was so hopeful but sadly this didn’t work for us. Do you have any other ideas?
Hey Lauren, it seems it worked for almost all those who left a comment 🙂 Can you try on a default, latest version of Woo (without plugins and with a default theme)?
This worked for me. Thanks for sharing!
🙂 Thanks Sarah!
Thanks! Still working on march 2017!
Thank you Andrés!
Thank you Sir, you saved my evening 🙂
My pleasure Pat! Thanks for your feedback 🙂
Hi rodolfo, thanks for this snippet, it works perfect, how ever im looking not to hide the shipping method, but showing it after shipping price. In other words change the order… Example: Shipping $10 (Flat Rate). Thanks in advance.
Hey Juan, thanks for your comment! Unfortunately this is custom and I cannot provide a free fix in the blog comments 🙂 Thanks for your understanding!
Your function is working fine in cart and checkout page .
When user complete the checkout process. there is a thank you page and shipping label still visible on that page.
Also an email of order shipping label is also visible in it. can you please let me know how ca i remove shipping label from thank you page and an email.
Many thanks in advamce
Sahil, thanks for your comment! Yes this is possible, however it’s custom work and I can’t offer you a complementary fix. I looked through the files to see if there was a filter you can use to disable that “via Flat Rate” label, and I found it:
You can take advantage if this to disable the label on the thank you and emails 🙂
Thanks for this! This works on the checkout page & I saw you mention that it doesn’t work in customer emails, but I was wondering if it can be changed within the My Accounts tab (after the customer has purchased). Currently, it still shows when I go to My Accounts. Thanks!
Hello,
How can I show the chosen shipping option in the basket totals?
Hello Soyful, thanks for your message! Can you send me a screenshot / mock-up to explain graphically what you’re trying to achieve? Thank you in advance!
Hello, sir in which file i have to set thise code…for removel shipping and handling option from cart page.
Hello Ganesh! You can place this in your child theme’s functions.php file – if you need more guidance, please take a look at this video tutorial: “How to Customize WooCommerce with PHP Snippets (even if you don’t know PHP)“. Hope this helps!
Hello, thank you for your code. It’s work for me. However the code only applied for shipping cost with fee only, it does not work for Free Shipping method. My cart page and checkout page still display “Free Shipping (Free)” and Free via “Free Shipping”. Can I hide Free shipping label also. Thank you for your sharing.
Hello Loi, thanks so much for your comment! I’m afraid I don’t see the “Free Shipping (Free)” label. What version of WooCommerce are you using?
I tried my snippet on StoreFront and WooCommerce 2.5.5 and it works: https://screencast.com/t/WncaH01jOY (removing “Free Shipping” would give you an empty label… not great!)
Let me know 🙂
Thanks you!
You’re welcome Yati!
Hello! Is it possible to only hide the labels on checkout page but still display them on cart page?
Hey Sebastian, thanks for your comment 🙂 Of course – you can use the conditional tag is_checkout() and make the function run on the checkout only:
Hello Rodolfo,
Thank you so much for your explanations. I assume I am supposed to add this function into my functions.php file in my theme correct?
If so, I did but it seems that its not working for me for some reason. Would you please help me on this?
Thank you a lot!
Regards,
Hashim
Hey Hashim, thanks so much for your comment! I just tested this snippet in Woo 2.6.2 and it still works correctly – and yes, I added this to my current theme’s (child theme) functions.php file. Try clearing the cache if you have a cache plugin 🙂
Hey! Does this code get rid of the shipping method label in the customer’s billing email? If so, then this is exactly what I need.
Also, where do I exactly insert this code? In my theme’s functions.php?
Meleah, unfortunately this code only works on Cart and Checkout pages. Doing the same in an email can be done but it’s custom and cannot cover this in this post. In case, get in touch 🙂 R
Hello, this doesnt work for me (www.electromes.gr/shop)
Hey Christopher, thank you for this. I’m trying to add a product to cart but I don’t see an Add to Cart button – can you help? Thank you
Thanks for the comment,
Unfortunately in this clients page you have to be a member to add to cart.
I see – if you want to send me login details I’ll see if I can fix the snippet for you. In case email me at infoATbusinessbloomer.com. R
Hi Rodolfo : I had try to add this , but it seems like My shipping method dropdop section is cart page not getting hide , I am using wp 4.1.5.
Please check this screenshot : http://www.awesomescreenshot.com/image/370924/647434e661b89b83b042a1da81f633a0
Sorry for a late , your code works awsome , My shipping lable get hidden , But is it possible to hide the whole shipping information in cart page , so that customer will get focused on shipping information only at checkout , Is this is possible .
Now i add my changes like
” .cart_totals table tbody tr.shipping{display:none;} ” In css,
But for this i need to set my default shipping to free of cost . Is there any way to do this?
Hey Karthick, thanks for your inquiry! Yes – you can set the default shipping via the Woocommerce / Settings / Shipping and by “ticking” the default shipping method at the bottom of the page. Hope this helps!
Very good and working for me 🙂
Thank you Arun 🙂