A common shipping model involves a base fee for the first item followed by another charge for each additional item in the cart. But in some cases, that base fee may need to change based on the items in the cart. Building on the Bundle Pricing tutorial, this article showcases only one base fee versus one base fee for each item type. Once again shipping classes become useful in defining these special rules for different types of items.
Matching Item Charges
In this example, the shop owner manages a store with three different classifications of products: Lightweight, Moderate, and Heavyweight. These items can be shipped together on the same pallet, so only one base fee is needed. However, each additional item added to the order will increase the shipping cost by a set fee for all items. The base fee will change depending on the heaviest class of items in the order.
|Shipping Class||Base Fee||Additional Items|
Based on the pricing table above, if an order contains items from the Moderate and Lightweight shipping classes, the base fee would be $7.00. If the order contained items from all three shipping classes, the base fee would be $10.00. Every additional item, regardless of shipping class, would be charged a flat rate of $2.50. Because the shipping class does not affect this extra fee, the Base Table Rules setting can stay set to Per Order.
In the table of rates, the order of the rows determines priority, so the shipping classes should be listed from least to greatest priority. The Conditions column will manage the shipping class requirement for each row. The Costs column will handle both the base fee and the additional fee, however there is a bit of a difference in the numbers entered. Each cost entry is going to apply to the entire order. It is not possible to ignore the first item in the ‘multiplied by’ cost entry. So the base fee must account for this by subtracting the first item’s additional fee. For example, the base fee for the Heavyweight class is $10.00 for the first item. We need to subtract $2.50 from that which gives us a new base fee of $7.50.
When using the table above to calculate shipping, the Table Rate method will go line by line through your configuration and choose one line to cover the entire order. If the order has a Lightweight item, the method will first qualify for the Lightweight row in your table. However, as it goes further into the table, if it finds there is also a Heavyweight item in the order, it will replace the original cost with the new one from the Heavyweight row.
Different Item Charges
For this second example we will use the same shop scenario as the previous tutorial. However this time the shop owner wants to adjust the additional item fees based on the shipping class as well. The revised pricing table is as follows:
|Shipping Class||Base Fee||Additional Items|
Since each shipping class has its own ‘Additional Items’ fee, the items in the order will need to be separated into groups based on their shipping class. To do this, change the Base Table Rules option to Per Class.
This shipping model is going to require multiple tables setup in the same method. Just like the rows in the table of rates, each table in the method also has a priority from least to greatest. By checking the Hide Other Options box next to each table, we will ensure that only one table returns a shipping option. The method chooses one row from each, the last qualifying row, to calculate the shipping cost. Similar to this, the method will only show one option, the last qualifying table, when you have checked the Hide Other Options box next to each table. This ensures that the customer sees the correct shipping cost, and not a partial calculation from another table.
There are three shipping classes, each with their own base fee and additional item fee. Therefor, we will need three tables to be created. Each table created will cover a different scenario based on the shipping class with the highest possible priority. So we start with the highest priority shipping class (and all classes below it), and with each table we remove the top shipping class so that the highest priority changes.
A few important things to note about this configuration:
- The Base fee is only applied to the highest priority shipping class in the first row
- Just like the first example, the ‘Additional Items’ fee needs to be altered, but only in rows where the base fee applies. In this scenario, the first item will always be of the highest priority class
- When calculating Per Class, a row must be found in the table for every shipping class found in the order. This is why orders with a Heavyweight item will never qualify for the third table, which only has a cost given for Lightweight items