I would like to know if it is possible to enable free shipping with Woo Commerce only if certain items (or items of certain categories / shipping classes) are included in the cart.
The Free Shipping option only activates on the basis of cart value or via a coupon code so I investigated Flat Rate shipping and discovered that it prioritises the most expensive shipping class over the cheaper ones. This means the free shipping class I created never overrides the default charge.
I understand the logic behind this but it’s the opposite of what I need as the idea is to incentivise purchases of higher profit margin products by eliminating delivery charges when they’re included in an order.
I don’t know if what I am trying to achieve is simply not possible within Woo Commerce. A coupon that only applies to certain products / categories seems to be the closest I can get but I’d rather not force users to enter a code at checkout.
Does anybody know if there any simpler ways to give users who purchase certain products free shipping?
Perhaps this doesn’t fully answer your question, but the table rate shipping plugin does give you the option to set a priority for a particular rate. Furthermore, this discussion gives a lot of hints as to where you could look for solutions
Actually, when creating a product you can just mark it as a Virtual product right within the product editor and that will exclude shipping completely for that item.
Here’s a snippet colleted from some Gists out of a GitHub issue discussion linked by @Ewout in another answer. I added a
var_dump()
, so you can uncomment and check what exactly you want to remove.$available_methods
is anarray
of:Compare against
$method_id
if you need more specific checks.I’ve created a WooCommerce plugin which allows users to configure advanced settings for free shipping. In the plugin it is possible to select certain products for free shipping.
You can find the plugin free on wordpress.org called WooCommerce Advanced Free Shipping
Hope this helps.
Based on kaiser’s code (above) I have created the following code:
And in turns of setting up WooCommerce, I have Free Shipping and Flat Rate both enabled in the Woo Shipping Options. Then I just set up a Shipping Class, specify it’s cost (e.g., £7.95) in the Flat Rate options page, and then just add that shipping class to the products I want to charge £7.95 p&p for.
The “virtual” option will remove all shipping costs, but it also deletes the option to ship to a different address than the customer’s billing address. This isn’t an issue if the customer buys other, non virtual products as well, but is if it’s the only thing they buy.