Change No Shipping Method Text in WooCommerce

I recently came across a situation where a site was using UPS to ship goods – however, they produced and shipped some items that were too large for UPS. In those situations, they wanted to have the user call them so shipping can be arranged… However, the basic default message could deter orders:

No Shipping Method Default Text

I’d heard the question asked frequently enough to want to dig in and do some research – below, you’ll find a quick code snippet you can enter that will change your message from “There are no shipping methods available. Please double check your address, or contact us if you need any help.” to anything else you want to display. 🙂

Changing the No Shipping Method Text

Update: December 29, 2016 There is an alternate way to add code than adding it directly to your functions.php sheet – see the guide here for more information.

What we need to do is modify our theme’s functions.php file. It’s always good practice to modify a Child Theme over the regular theme, and you should always have a backup using something like BackWPup or Duplicator. 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. This was written for WooCommerce version 2.5.2 and WordPress 4.2.2. Use at your own discretion!

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

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 “we will call you when the order goes through to negotiate shipping”. Save the functions file and go back to your site.

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

New Shipping Message

Much better!

Note that this changes the given error message, regardless of circumstance. This means if you only ship to the US, but a Canadian address is entered, the message will display.

Advanced Use

We can take the above code and add some conditions – with the code below, the message will appear only if items from a certain Shipping Class are in the cart, otherwise the regular message will display.

Before we get to code, we need to first create a new Shipping Class and assign it to the items that are oversized – see the official WooCommerce documentation on how to set up Shipping Classes. Once we have a class, we need to grab the Class ID. To do this, open your Shipping Class settings for the specific class that will receive the custom message – in my case, oversized items will be added to “Class 2”.

Shipping Classes
These settings can be found in your Products > Shipping Classes menu.

In the URL, you’ll see your ID like so: taxonomy=product_shipping_class&tag_ID=32 – this means, the ID is 32.

Your ID WILL be different - be sure to use the correct ID.
Your ID WILL be different – be sure to use the correct ID.

Now, we’re ready to use the modified code:

The error message will only display if items in that shipping class are in the cart – otherwise, the regular shipping error message will appear.

I hope this helps!