Created
November 10, 2020 14:13
-
-
Save gaiqus/3e3d53343a48c8e0a512c65732a66c5e to your computer and use it in GitHub Desktop.
Change the “No Shipping methods available” Message in WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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