Skip products from shipping package
The code facilitates you to skip the product(s) during calculation of shipping cost as well as printing shipment label.
Add the following code to your functions.php or anywhere relevant.
In the above code, $shipping_free_classes contains the shipping class IDs which need to be excluded from the cart. $shipping_class contains the shipping class IDs of the products which are present in the cart. If $shipping_free_classes contains $shipping_class, then assign true to $skip and return it.