There are no pre-requisites in order for you to be able to implement this solution.
Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.
Need support with the snippet? We’re Here to Help You, Contact Us!
Firstly, you try to achieve free shipping if a certain product is in the cart by using shipping classes. Only implement this solution if you have exhausted native WooCommerce tools. This solution simply bypasses these rules if you have a basic store setup and don’t have a need for shipping classes. In summary, these code snippet looks at all the products in the cart, and if a particular product is found, free shipping is granted for the entire order. This type of rule could encourage users to buy a particular product from your store because there is a free shipping incentive. You will need the product ID of the product to trigger enabling of the shipping method which will be hidden. To get the product ID, go to Dashboard > Products > All Products then hover over your desired product – you will see the Product ID appear under the product name. You will also need the shipping method radio button value which is explained in more detail further on in this guide.
Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.