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
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

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 PHP snippets at the bottom of your child theme functions.php file and CSS at the bottom of its style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my guide "Should I Add Custom Code Via WP Editor, FTP or Code Snippets?" and my video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything went as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting.

If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

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.

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? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. 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 BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

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