WooCommerce 2.4 introduced a lot of cool features. One of my favorites is the simplification / enhancement of flat rate shipping. Previously, flat rate shipping had a lot of settings, and was a bit difficult to set up. But Helpful Hedgehog helped changed all of that by simplifying flat rate.
Flat Rate "Shortcodes"
Even though it appears settings were removed, you can actually get more done with flat rate now through the use of some shortcodes. Here are a few examples I've thrown together:
- $10 plus $1 per item in the cart:
10 + ( 1 * [qty] )
- $10 plus 10% of the cart’s total value:
10 + [fee percent="10"]
- The above, with a minimum of $25 added:
10 + [fee percent="10" min_fee="25"]
- $10 plus 5% of the cart’s total value up to $50:
10 + [fee percent="10" max_fee="50"]
- And then throw it all together:
10 + [fee percent="10" min_fee="5"] + ( 1 * [qty] )
Shipping Classes
These new shortcodes alone can definitely be useful, but they are even more-so when you throw shipping classes into the mix. When you have shipping classes created, you will see an additional "Cost" field for each in the flat rate settings. So with each of these, you can use your own combinations of the above examples to create custom rates that apply to different products.
For example, with shipping classes you can easily offer Free Shipping for some of your products but not all. To do this, leave the main "Cost" field at $0, and only add in shipping costs in the shipping classes section (be sure to utilize the "No Shipping Class" field). So now if the customer adds just a free shipping product to their cart, flat rate will be free.
There is also a "Calculation Type" setting underneath of the shipping classes. The "Per Class" option will charge shipping for each shipping class individually. So if you have two items in the cart each with different shipping classes and costs associated with the class, the item will have their own shipping cost added to the flat rate. If you do not want costs to stack like this, you can choose the other option, "Per Class", which will only charge shipping for the most expensive shipping class.
Here is an example screenshot of some settings utilizing shipping classes and the shortcodes. Flat Rate will cost $5, with $3 dollars more per large item, $2 more per small item, and $1 extra for each item without a shipping class.
These new changes add a lot more possibilities for shipping configurations using just the core functionality in WooCommerce. You would would have previously needed Table Rate Shipping for this sort of functionality. Table Rate Shipping still holds a lot more power for complex setups though. So if you find the above options aren't quite enough, I definitely recommend looking into Table Rate.
Thank You! The fist code was what I needed to figure out. Saved me from having to buy the table shipping plugin
This was very helpful, thank you for sharing. I’m surprised that Woo doesn’t have better documentation on their website.