How to done a error message under shipping method in magento 2
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
In Back-end, there is one option available to show error message. You just need to enable this setting there "Show Method if Not Applicable".
You do not need to add any custom code. Just follow "Bank Transfer" or any other default Magento Shipping method modules and you can add that functionality for your custom shipping methods as well.
You need to check this file
There is Magento showing that error message.
Hope this will help you!