Skip to content

Instantly share code, notes, and snippets.

@gaiqus
Created November 10, 2020 14:13
Show Gist options
  • Save gaiqus/3e3d53343a48c8e0a512c65732a66c5e to your computer and use it in GitHub Desktop.
Save gaiqus/3e3d53343a48c8e0a512c65732a66c5e to your computer and use it in GitHub Desktop.
Change the “No Shipping methods available” Message in WooCommerce
class WPDeskNoShippingMessage {
/**
* Register hooks.
*/
public function add_hooks() {
add_filter( 'woocommerce_no_shipping_available_html', [ $this, 'change_message' ] );
add_filter( 'woocommerce_cart_no_shipping_available_html', [ $this, 'change_message' ] );
}
/**
* Change message.
*
* @param string $message
*
* @return string
*/
public function change_message( $message ) {
return __( 'Your order is too heavy. Please contact us to get individual shipping cost' );
}
}
( new WPDeskNoShippingMessage() )->add_hooks();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment