miguel.nz

Adding a custom message on Woocommerce shipping rate

April 10, 2020   |   1 minute read.

Often we want to add a custom message on a shipping method or rate. If you are handling multiple methods you can simply use the “woocommerce_after_shipping_rate” action on your functions.php file:

add_action( 'woocommerce_after_shipping_rate', 'action_after_shipping_rate', 20, 2 );
function action_after_shipping_rate ( $method, $index ) {
    // Targeting checkout page only:
    if( is_cart() ) return; // Exit on cart page
    
    if( strcmp('Your Shipping method label', $method->label) == 0) {
    	echo 'Custom Message';
    }
}