Skip to content

Instantly share code, notes, and snippets.



Last active Mar 12, 2020
What would you like to do?
Snippet to customize the “There are no shipping methods available..” message found on the WooCommerce cart or checkout page based on cart total weight. Supports PluginHive Shipping Plugins:
// For Cart Page.
add_filter( 'woocommerce_no_shipping_available_html', 'wf_customize_default_message_if_weght_exceeds', 10, 1 );
// For Checkout page
add_filter( 'woocommerce_cart_no_shipping_available_html', 'wf_customize_default_message_if_weght_exceeds', 10, 1 );
function wf_customize_default_message_if_weght_exceeds( $default_msg ) {
$weight_limit = 50;
$custom_msg = "Call us for quotation - 1-800-XXX-XXXX";
global $woocommerce;
$cart_weight = $woocommerce->cart->get_cart_contents_weight();
if ( $cart_weight > $weight_limit ) {
if( empty( $custom_msg ) ) {
return $default_msg;
return $custom_msg;
return $default_msg;

This comment has been minimized.

Copy link

@Dusty4848 Dusty4848 commented Sep 16, 2019

Thanks, Still working in woocommerce 3.6.4, and WP 5.2.2

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.