Edit or Change Shipping Method Text in WooCommerce Checkout Process

0
135

I am working on a Woo Commerce Project for an Outsource client. and working custom shipping zones based on Postal Codes. Now client want to Add Custom Message if customer belongs outside of shipping zone. Daufault message is “Please ensure that your address has been entered correctly, or contact us if you need any help” to “Your postcode is outside our normal delivery address. Please call NAME OF CLIENT on 1234567 to discuss whether we can offer delivery”

So i searched and digout the Google and Youtube and try this snipits and it is worked for me on WooCommerce V3.8.1.

Where Code Need to Added

We need to do is modify active theme’s functions.php file. It’s always good practice to modify a Child Theme instead of  the regular theme, and you should always have a backup using something like BackupBuddy. Playing with the functions.php file is playing with fire – misuse can crash your site so the only way to recover is to FTP in and modify the file to remove your changes.

In our functions.php file, we add the following:

add_filter( 'woocommerce_cart_no_shipping_available_html', 'change_noship_message' );
add_filter( 'woocommerce_no_shipping_available_html', 'change_noship_message' );
function change_noship_message() {
print "Please call us after placing your order to negotiate shipping: <br />(123) 456-7890";
}

When we view the cart which was formerly giving us the error message, we see:

In the second to last line (the one starting with print:), you can modify anything within the parenthesis to have it display – the only exception is that you can’t use another “. In the example, it’s telling the customer to call a phone number, but you could simply have it say something like “Your postcode is outside our normal delivery address. Please call NAME OF CLIENT on 1234567 to discuss whether we can offer delivery”. Save the functions file and go back to your site.

 

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.