Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce: Change the "no shipping method available" message to minimise customer confusion.
<?php
/*
Plugin Name: WooCommerce - No shipping method message
Plugin URI: http://www.damiencarbery.com/2017/10/change-no-shipping-methods-available-message/
Description: Change the "no shipping method available" message to minimise customer confusion.
Author: Damien Carbery
Version: 0.1
*/
add_filter( 'woocommerce_cart_no_shipping_available_html', 'nszm_no_shipping_available_html' );
add_filter( 'woocommerce_no_shipping_available_html', 'nszm_no_shipping_available_html' );
function nszm_no_shipping_available_html( $message ) {
$country = WC()->customer->get_shipping_country();
if ( !empty( $country ) ) {
$all_countries = WC()->countries->get_countries();
return sprintf( "Oops - we don't ship to %s.", $all_countries[ $country ] );
}
return "Oops - we don't want your business.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.