Contents
WooCommerce flat rate shipping is the easiest shipping method to set up. In this post, let’s find out how to setup flat rate shipping in WooCommerce and see how it fits to your business model.
What is flat rate shipping?
If you have sent a package via post office before, you should be familiar with flat rate shipping. As the name suggests, flat rate shipping impose an uniform shipping price on your package as long as it doesn’t exceed a certain weight or size.
For example, the shipping cost for packages less than 10 kg and 1 cubic meter is $10 per package.
The same idea applies to WooCommerce flat rate shipping.
How to setup flat rate shipping in WooCommerce
By default, WooCommerce has three shipping methods
- flat rate shipping
- local pickup
- free shipping
In order to use one of those method, you need to create a shipping zone first then in the zone, you can add one or more shipping methods, including flat rate.
After creating one WooCommerce flat rate shipping method as in the above image, you can configure the rate, tax of that shipping method by clicking on the Edit link under “Flat rate”:
As you can notice, there is a toggle button right below the Enabled title. You can enable or disable the shipping method by turn that button on or off.
Can I have multiple flat rate shipping setup?
There is no limit on number of shipping method per zone so you definitely can have multiple flat rate shipping setup, in one zone. You may wonder, why do I need multiple flat rate shipping for one zone?
One good example is you provide standard shipping at a lower rate and priority shipping at higher rate. At the cart page, customers can choose which shipping method they want to use. If they need the products to be delivered fast, they will choose the priority shipping method. Otherwise, they can choose the standard shipping method to save money on shipping.
Let’s set that up:
Now, on the cart page, the customers will see all the shipping options available:
How to add flat rate shipping per item using shipping classes
At this point, you should be comfortable with adding flat rate that applies to all items. What if you want to set a different shipping rate for some particular items? For example, I have a store selling computer hardware. While keyboards, mice can be shipped without much care, monitor requires special packaging and handling. I would like to charge $50 more for monitors. How can I set that up?
First we need to add a shipping class. Adding shipping class in WooCommerce is simple. Let’s go to WooCommerce->Settings->Shipping->Shipping classes and add one:
Now, the next step would be to go the monitor and assign it the “monitor” shipping class:
Finally, let’s configure the shipping rate for “monitor” shipping class in our shipping methods.
Let’s go to WooCommerce->Settings->Shipping->Shipping zones and edit our zones. Let edit all the enabled flat rate shipping method in that zone and add the additional fee accordingly:
Now if I go to the cart, I can see that the shipping cost is higher:
If you remember, the standard shipping was $10 and the priority shipping was $30. Since we added $30 for the “monitor” shipping class, the shipping cost updated accordingly.
WooCommerce flat rate shipping by quantity
If you notice that we have 2 items in cart here. The shipping cost for the “monitor” only calculated once. What if you want to charge the additional shipping cost PER ITEM?
That’s easy, let’s go back to our shipping methods and edit each of them then enter this:
Now, if I go to the cart page, surely I’ll see the shipping cost is calculated for all items in cart:
Hide flat rate shipping if free shipping is enabled
You may want to reward the customers by offering free shipping to all order exceeds $300. In this case, you also want to hide other flat rate shipping methods. What can you do to achieve this?
You’ll need to enter some code. Don’t worry, it won’t be hard.
First thing first, you need to create a child theme if you haven’t got one. Why do you need a child theme? How to create one? Find all the answers here
Now you have your child theme ready. Let’s go to its functions.php file and paste the following code:
function bc_hide_shipping_when_free_is_available( $rates ) {
$free = array();
foreach ( $rates as $rate_id => $rate ) {
if ( 'free_shipping' === $rate->method_id ) {
$free[ $rate_id ] = $rate;
break;
}
}
return ! empty( $free ) ? $free : $rates;
}
add_filter( 'woocommerce_package_rates', 'bc_hide_shipping_when_free_is_available', 100 );
Click on update file and let’s go to the cart page, you’ll see that if free shipping is available, all other methods are hidden:
Conclusion
As you can see, flat rate shipping at first seems to be rigid and hard to customize. However, when combine with shipping classes and free shipping method, you can offer very flexible shipping options for your customers. Using WooCommerce shipping classes enables you to set the max shipping fee for an order, set the shipping fee based on the quantity and the total of the cart.
Esti nemaipomenit!! :* :*
Very good! Is there a way to make the local collection available at the same time whithe de free shipping. We have clients that still want to come to the shop to pick up the goods, and i wan’t to give them that option
Hi Stefan,
Yes, that’s possible. Have you tried adding local pickup to your shipping methods?
Greetings,
A nice, useful post. Question I have: I have items that can be packed 3 in a flat rate box. I would like to have the “flat rate” be, say, $7.95 * ([qty]/3 + 1), but the division is not integer division.
Do you know if that is possible ?
Many thanks for an answer 🙂
hi,
can this code be modified to hide “Flat Rate” Shipping.
BUT not for free shipping, as we do not offer that – BUT
Where a product does NOT have a Shipping Rate applied
dropdown has
NO Shipping Class
and therefor during the checkout process ONLY “local pickup” should be applied
I dont know the code very well, But i’m hoping this is a simple modification to say
If Rate = No Shipping class
Then do not display Flat Rate