I recently had a client for whom I had added a separate line to their WooCommerce checkout process specifically for handling fees (they needed it displayed and calculated separately from the actual shipping charges). But now that meant that one line was labeled “Shipping and Handling” and then another line was named “Handling”. This was rather confusing. So I needed a function that changed that text without hacking the core files of WooCommerce. Here’s the solution if you find you need it. Note: This is not an uncommon need in WooCommerce so this function is probably found in many places all over the web. I’m keeping it here as much for my own future reference as to provide it to you.

Remember that this code goes inside your theme functions.php file.

// change shipping and handling text to "Delivery Charges"

add_filter('gettext', 'translate_reply');
add_filter('ngettext', 'translate_reply');

function translate_reply($translated) {
$translated = str_ireplace('Shipping and Handling', 'Delivery Charges', $translated);
return $translated;
}

Just change ‘Delivery Charges’ to whatever you want the line to be titled, and you’re done!

thePixelPixie.com - WordPress boutique

Subscribe and receive my FREE eBook


4 MISTAKES You’re Making on Your Website that are Costing You MONEY!

  • This field is for validation purposes and should be left unchanged.

The Author

Save

Like thePixelPixie on Facebook

Leave a Reply

Your email address will not be published.

Ready to chat about how ThePixelPixie can help?