WooCommerce: Translate “Shipping” @ Cart Totals

The cart totals table cell title “Shipping” or “Shipping and Handling” appears also on the checkout page. So, what if you wish to “translate” this string from English to “better” English or completely customize it? Thankfully there’s a quick 4 lines snippet for you. Enjoy!

Editing/translating the Cart Totals “Shipping” table cell title @ WooCommerce Cart & Checkout

PHP Snippet: Translate “Shipping” @ WooCommerce Cart Totals & Checkout Order Review

/**
 * @snippet       Translate "Shipping" - WooCommerce Cart & Checkout
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.8
 * @community     https://businessbloomer.com/club/
 */

add_filter( 'woocommerce_shipping_package_name', 'bbloomer_new_shipping_title' );

function bbloomer_new_shipping_title() {
   return "Delivery";
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: How to Fix the “Cart is Empty” Issue
    For some reason, sometimes you add products to cart but the cart page stays empty (even if you can clearly see the cart widget has products in it for example). But don’t worry – it may just be a simple cache issue (and if you don’t know what cache is that’s no problem either) or […]
  • WooCommerce: “You Only Need $$$ to Get Free Shipping!” @ Cart
    This is a very cool snippet that many of you should use to increase your average order value. Ecommerce customers who are near the “free shipping” threshold will try to add more products to the cart in order to qualify for free shipping. It’s pure psychology. Here’s how we show a simple message on the […]
  • WooCommerce: How to Translate / Rename Any String
    There are times you don’t want to translate the whole installation of WooCommerce just for renaming one short string. There are times you need to rename a label or a little thing and don’t feel like installing a bloated translation plugin. It doesn’t matter whether you want to rename a string in the original language […]
  • WooCommerce: Cart and Checkout on the Same Page
    This is your ultimate guide – complete with shortcodes, snippets and workarounds – to completely skip the Cart page and have both cart table and checkout form on the same (Checkout) page. But first… why’d you want to do this? Well, if you sell high ticket products (i.e. on average, you sell no more than […]
  • WooCommerce: Disable Payment Method If Product Category @ Cart
    Today we take a look at the WooCommerce Checkout and specifically at how to disable a payment gateway (e.g. PayPal) if a specific product category is in the Cart. There are two tasks to code in this case: (1) based on all the products in the Cart, calculate the list of product categories in the […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

28 thoughts on “WooCommerce: Translate “Shipping” @ Cart Totals

  1. Hi. can you tell me how to change the text TOTAL to another text, e.g. TOTAL PRICE?

  2. It works great! Just plugged the code into my functions.php and vualΓ‘. Too bad I can’t understand why it works. No clue how this refers to specific instances. What if the word exists in multiple places and you only want to change it in one? Just curious so i can use it in other circumstances I may need. Thanks for sharing your solutions. They are awesome.

    1. Awesome! Inside the function you can use WordPress conditionals and only trigger this on a specific page (is_page). Hope this helps!

  3. This does not seem to work any longer. But this worked for me:

    add_filter( ‘woocommerce_shipping_package_name’, ‘custom_shipping_package_name’ );
    function custom_shipping_package_name( $name ) {
    return ‘Delivery’;
    }

    1. Awesome and thank you! Snippet revised πŸ™‚

  4. great snippet works great. Thank u very much

  5. Hi !

    Thanks for a great article !

    The code only replaces one instance of “shipping” to “delivery” on my page (the Address) section but not the instance in the total section. I’ve tried experimenting with changing other words (e.g. Total) and this works. Any idea what’s stopping the translation for shipping ?

    Many thanks in advance for any advice – much appreciated πŸ™‚

    1. Hey Richard, thanks for your comment! You might need a second call or maybe that’s coming from your theme or specific plugin. Sorry but I can’t offer free support here in the blog comments πŸ™‚

  6. hi. my site is multilingual (English as main language & Bahasa Indonesia). if i use this code, is the translated version going to show only when visitor switch to Bahasa Indonesia? (i want it to be so)
    thanks

    1. Hey Sandra, thanks so much for your comment! No, this solution I think applies to all languages – if your site is multilingual, instead, you should have a function to edit such string in your multilingual plugin. Do you use WPML or similar?

  7. Hi Rodolfo!

    I attended your class last month and signed up to attend the one next week- I’m so excited!

    I am interested in renaming the “Calculate Shipping” button (located under Cart Totals Table) to “Calculate Taxes” (since this functionality calculates both shipping & taxes) so I wanted to know if you had any idea how to rename it? I did some research and there appears to be a Shipping.php file but I know if a new version of Woocommerce comes out it would get overridden. Any ideas? Also, is it possible to add the “Calculate” button on the Checkout page as well?

    Thanks,

    April

    1. April – awesome! I’m looking forward to next week’s event as well πŸ™‚

      In regard to the string translation question, check this out: https://businessbloomer.com/translate-single-string-woocommerce-wordpress/. It should help you with that.

      In relation to the calculate button, the checkout calculates shipping already – not sure why you would need it there again? Maybe explain that a little better and I’ll get back to you with an answer πŸ™‚

      Cheers!

      1. Hi Rodolfo,

        Great, thanks! I will check out the thread.

        So, the reason why I was interested in adding the ‘Calculate Shipping’ to the Checkout Page as well, is just in case the user doesn’t calculate the shipping on the Cart page and wants to do it on Checkout. I do think it’s redundant but I just wanted the user to have the option for both pages πŸ™‚

        Thanks,

        April

        1. No problem πŸ™‚

          Re: shipping calculator I don’t honestly think that’s good for UX. On the checkout, people can select shipping methods and “calculate” shipping in that way – it’d be redundant in my opinion. Of course there is a way to add it there as well (find the PHP that is generating the calculator and try copy/paste that on the checkout via a hook) – good luck!

          1. You have a good point! Thanks for the insight. Have a great day πŸ™‚

            1. No problem at all πŸ™‚ Talk soon!

  8. Great in theory, and I used it to change from “Shipping” to “Shipping and Handling”, but I was frustrated to find that it changes it everywhere. It even says “Shipping & Handling Address” instead of “Shipping Address” on the invoice. Is there a way to just change it just on the cart totals and invoice totals?

    1. Thanks for your feedback! Good point – of course you can trigger the function only on the Cart page for example by using:

      if (is_cart()) {
      // run function
      }

      In this way the snippet will only be called on the Cart page. Hope this helps!

  9. Hello,
    Great, thank you for that! πŸ™‚
    Can i remove text with that function?
    Best regards!

    1. Anze, thanks for your feedback! Of course – just enter ” (2 single quotes) in the second place and the string will be translated into an empty one! Rodolfo

  10. Fatal error: Call to undefined function add_filter() in /home/u627751393/public_html/wp-includes/functions.php on line 10

    1. Thanks Anon for your feedback. This code works with every version of Woocommerce so you probably forgot an apostrophe or a parenthesis. Can you check this please?

  11. Hi

    Can this be used to translate more than one string?

    1. Yes Tom, of course. Use an array:

      // Add this to your functions.php
      add_filter('gettext', 'translate_enhu');
      add_filter('ngettext', 'translate_enhu');
      function translate_enhu($translated) {
      $before = array ("word1", "word2");
      $after = array ("newword1", "newword2");
      $translated = str_ireplace($before, $after, $translated);
      return $translated;
      }
      
  12. Hi… and if I wanted to translate that string in 5 languages … how can I do?
    Thanks πŸ™‚

    1. Mik thanks for your message! If you want to translate this in 5 languages you will need to use a plugin such as WPML or Codestyling Localization (a free plugin that used to be on the WordPress repository but for some reason I can’t find at the moment). Hope this helps!

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *