Solution:
The following code will output an error message on checkout page, if no shipping method has been chosen when submitting the order:
// Validate shipping method fields and returning an error if none is choosed
add_action( 'woocommerce_checkout_process', 'shipping_method_validation', 20 );
function shipping_method_validation() {
if ( ! isset( $_POST['shipping_method[0]'] ) ){
wc_add_notice( __( "You need to choose your a shipping option.", "woocommerce" ), 'error' );
}
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.