I am trying to change a text in the WooCommerce checkout page from Shipping to Delivery from Your Order Section. I tried to open the core files in FTP and tried to change it manually but I couldn't find the text anywhere. Any help on how to change it?
Go to: WooCommerce > Settings > Shipping > Shipping Zones. Hover over Zone Name, and the option to Edit and Delete appear. Select Edit, and a screen appears so you can change the name, regions or shipping methods. Save changes.
Did you tried like this below:
// Add this to your functions.php
add_filter('gettext', 'translate_reply');
add_filter('ngettext', 'translate_reply');
function translate_reply($translated) {
$translated = str_ireplace('Shipping', 'Delivery', $translated);
return $translated;
}
Please see this link too: http://businessbloomer.com/woocommerce-edit-translate-shipping-handling-cart-checkout-page/ for more details
I used the solution by @Rahul S but I added the next code to change specific delivery text on cart and checkout.
I added this code to the function.php on my theme. It work on cart page and checkout page
You can replace ‘put-here-you-domain-i18n’ by you domain, by default it is ‘woocommerce’ by I recommend change it.
The code to add is:
add_filter( 'woocommerce_shipping_package_name' , 'woocommerce_replace_text_shipping_to_delivery', 10, 3);
/**
*
* Function to replace shipping text to delivery text
*
* @param $package_name
* @param $i
* @param $package
*
* @return string
*/
function woocommerce_replace_text_shipping_to_delivery($package_name, $i, $package){
return sprintf( _nx( 'Delivery', 'Delivery %d', ( $i + 1 ), 'shipping packages', 'put-here-you-domain-i18n' ), ( $i + 1 ) );
}
I hope help you.
You can see this.
If you copy the files you need to edit from wp-content/plugins/woocommerce/templates
to wp-content/themes/*your_theme*/woocommerce
. That way you can override the code without touching the plugins code.
You will find the code you need to change will be under wp-content/themes/*your_theme*/woocommerce/checkout
, although if you want to change all instances of the word Shipping you will need to change more of the templates.
List of files that contain Shipping are
woocommerce/cart/cart-shipping.php
woocommerce/cart/cart-totals.php
woocommerce/cart/shipping-calculator.php
woocommerce/checkout/form-billing.php
woocommerce/checkout/form-login.php
woocommerce/emails/email-addresses.php
woocommerce/emails/plain/email-addresses.php
woocommerce/myaccount/form-edit-address.php
woocommerce/myaccount/my-address.php
woocommerce/order/order-details.php
There is probably more so you'll have to do a search in the other template files.
I can see this is an older thread but it had the answer I was looking for. I extended the solution from @Rahul S so the one function could translate multiple strings if desired. It it a revision of a function I use for Event Calendar by ModernTribe. Being in the US I used "Shipping and Handling" in place of "Delivery."
add_filter('gettext', 'zgwd1010_woo_translations', 20, 3);
add_filter('ngettext', 'zgwd1010_woo_translations', 20, 3);
function zgwd1010_woo_translations( $translation, $text, $domain ) {
// Put your custom text here in a key => value pair
$custom_text = array(
'Shipping:' => 'Shipping and Handling:',
);
if( array_key_exists( $translation, $custom_text ) ) {
$translation = $custom_text[$translation];
}
return $translation;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With