How To Change the ‘No shipping methods available’ Text in WooCommerce?

Do you want to change the default WooCommerce no shipping methods available text?

You have landed at the right place!

You’ve probably seen the “No shipping options were found” message on the WooCommerce cart page. 

Unfortunately, there are times when it doesn’t explain everything and leads to abandoned shopping carts. However, you’ll find it helpful once you learn how to tweak it.

For example, You can change the text to tell users that they need to add a minimum of 4 products to get the shipping methods. Similarly, there are various occasions when you want to change the no shipping methods available text.

In today’s article, I’ll share the piece of custom code that you can add to your WooCommerce store to change the no shipping methods available text. 

The code is simple to understand. So without any further ado, let’s jump into the tutorial. 

How To Change the ‘No shipping methods available’ Text in WooCommerce?

Following is the code to help you change the shipping method text in WooCommerce

1. Filter Hook

Changing the text on a WooCommerce cart page requires a filter hook that refers to specific points in the WooCommerce loading pattern. Following are the filter hooks that you should use. 

add_filter( 'woocommerce_no_shipping_available_html', 'custom_no_shipping_message' );

add_filter( 'woocommerce_cart_no_shipping_available_html', 'custom_no_shipping_message' );

2. Callback Function to Change the Text

We need to write the callback function to change the no shipping methods available text in WooCommerce. 

Note: Please remember that the function’s name should be the same as the above hook. If you change the function name in the hook, then ensure you also change the function name in the following code. 

Also, you can replace the ‘A minimum of 6 products is required. Add more products to complete your purchase’  with the message you want to display. 

function custom_no_shipping_message( $message ) {
	return __( 'A minimum of 6 products is required. Add more products to complete your purchase' );
}

The whole code will look something like this: 

 
add_filter( 'woocommerce_no_shipping_available_html', 'custom_no_shipping_message' );

add_filter( 'woocommerce_cart_no_shipping_available_html', 'custom_no_shipping_message' );
function custom_no_shipping_message( $message ) {
	return __( 'A minimum of 6 products is required. Add more products to complete your purchase' );
}

3. Paste the Code to Your WordPress Site

After that, we need to add the above code to the WordPress site to change the no shipping methods available text in WooCommerce on the cart page

You can use a plugin to paste the code. Please follow this tutorial on how to Add a Code Snippet to WordPress to learn more about adding custom code to WordPress. 

4. Final Results

Once you have added the code, let’s check whether it is working. 

I added a product to my cart to test it and visited the cart page. As you can see in the screenshot that the code worked, and the no shipping method available text has been replaced with the one I added through the code. 

Final Thoughts

That’s it for today’s article. 

I hope this article was helpful to you and you were quickly able to change the no shipping methods available text in WooCommerce. Please let me know if the code doesn’t work. I’ll be happy to revise it for you. 

Brian
Brian

Welcome to the AovUp blog, where we discuss all things WooCommerce. I hope we can help you achieve something today...

Leave a Reply

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

We – and our partners – use cookies to deliver our services and to show you ads. By using our website, you agree to the use of cookies as described in our Cookie Policy