Since you have made a shipping class for to be displayed for the product which is not there in that shipping class, there is one way that might help you achieve that.
Changing the shipping method based on shipping classes using a code snippet is surely a tedious task.
In that case, the Table Rates Shipping Pro plugin can help you achieve this business case. You can check out the plugin and purchase it from here.
Do let us know if you need any help setting up the plugin once you purchase it. We will surely help you.