I am using the UPS extension in woocommerce. I need to offer free shipping on some items, bypassing the UPS calculator. It seems one good way to do this is to mark the item as “virtuaL,” but then the item doesn’t require shipping. I need to require shipping for this item. I have been able to customize the checkout page and force the shipping fields to show on the virtual items, but then they don’t store in the actual orders.
Anybody know how I can create a custom function or modify the woocommerce files to force the checkout process to require shipping on a virtual item, all while bypassing the UPS calculator? (other items need to be calculated for shipping)
I was having the same issue, the Author of the plugin replied to me that it can’t be done, one have to write the code to do that.
I just ran into this issue, maybe this will help someone out. For all of the products that I wanted free shipping, I made virtual products.
Then I went to Woocommerce > Shipping Options Tab, check the box that says “Collect shipping address even when not required” which is in the “Shipping Destination section”.
I needed exactly this as well, and have a workable solution:
First go into your
functions.php
in"Appearance"->"Editor"->"Theme Functions"
, and add the following code (I highly recommend using a “child theme” first, so you are not modifying your theme’sfunctions.php
…or you could alternatively create a custom plugin).Second, go into the
"Products"->"Shipping Classes"
and create a Shipping Class called “Free Shipping
” with a slug called “free-shipping
” (the slug name is what we will tie our custom function to). Then “Add New Shipping Class
“.Then in your
"WooCommerce"->"Settings"->"Shipping"->"Flat Rate"
enable “Flat Rate
” shipping, and under the “Shipping Class Costs
” section put a value of “0.00
” next to the “Free Shipping
” class we just created. In my case, I also have “Calculation Type
” set to “Per Class
“. Then “Save changes
“.Then finally in
"WooCommerce"->"Settings"->"Shipping"->"Shipping Options"
in the “Shipping Methods
” section, make sure “Flat Rate
” has a higher “Selection Priority
” (in the column of that name) than whatever other shipping method(s) you are using, and that it is the last one on the list (you can drag to reorder using the menu icon on the left of each option). “Save Changes
“.Then edit one of your products that you wish to have free shipping, go to the “
Product Data"->"Shipping
” section and change the shipping class to “Free Shipping
” (the new class you created). Then “Update
” that product to save the changes. Then also add it to your cart, and also add some other item to your cart that has regular non-free shipping.Test.
You should now see that free shipping items get their own shipping “package” row (“
Shipping #1
” and “Shipping #2
“) separate from the items that should still charge for shipping, even when you have some of each kind in the shopping cart.Alternatively, you could also try the full paid plugin called “Per Product Shipping“.
Or this free plugin may work as well (no promises).
Another way that I believe may help you to make an item have “free” shipping (and a way I have used in the past), is to create a coupon that will discount the product (don’t mark it as “virtual”) to that of it’s price minus shipping.
So say for example your product is $100 and shipping is $10 (total of $110), you then create a coupon specifically for that for product(s) that will give it a $10 discount making your product & shipping total $100.
I assume you already know how to create coupons in woocommerce (if you need some refreshing on how to do so this page will help). To make the coupons apply to a specific products which you want to have free shipping, go to Usage Restriction->Products and specify the specific product you want to have “free” (or in this case, discounted) shipping.
To save the user the trouble of entering this coupon code upon checkout, you can add the following code to functions.php:
Please note that I have not tested this code with the UPS extension yet, but feel free to modify and play around with it.
I hope this post is/was of some help to you!