Shipping classes are a great way to setup different rules and pricing for items in your shop. Usually due to weight or size, some of these items may ship for little or no cost to you. Because of this, shipping class priorities allow you to change the terms based on the highest priority item in the cart. The Single Class Only option will allow you to ignore the smaller items in the cart assuming they ship at no cost with the larger item.
Using the Per Class Condition
Often when customers are purchasing multiple items, you can fit the smaller items in the same box as the larger items. However, if they order only smaller items, you still need to be compensated for the small box and postage price. This example works similar to the Per Order scenario in the Shipping Class Priorities article. The primary difference is actually with the conditional statement. Using the Per Order condition allows you to prioritize the shipping, but if you decide to have a conditional statement based on weight, the condition will be based on the order’s weight. By using the Per Class condition in combination with the Single Class Only option, you can setup the same priorities, but the condition is based only on the weight of the items in the highest priority shipping class.
In this example, the shop owner manages a boutique that sells dresses and jewelry online. When purchased alone, jewelry will need to ship in a small box. But when purchased with a dress, the two items can ship together, and thus the jewelry ships at a much lower rate. However, this shop owner would like to charge more depending on how much the dresses weigh. This way the customer will need to pay more in shipping when ordering multiple dresses.
The first step is to setup the priorities for your shipping classes. Under the Shipping tab of your WooCommerce settings page is a sub-link titled Shipping Classes. Here you will find a list of your existing shipping classes and can add more classes if needed. This shipping method adds a new column titled Priority for setting which classes are most important. For this example, the shop owner has two classes: Jewelry and Dress. Every product in the shop has been assigned to one of these shipping classes.
As you can see in the image above, the Dress shipping class has a higher priority number than Jewelry. Priorities are placed from highest to lowest, so the higher the number, the higher the priority.
Once the priorities are setup, return to your Table Rate method settings to configure the shipping. Under the General Settings section is the option Base Table Rate. This should be set to Per Class so that prices are calculated for each group separately. In the Additional Options section is the Single Class Only option. Selecting the Highest Priority option will use the priorities you have set to determine which group is used.
The table below shows how shipping classes are used to setup costs for shipping. Jewelry alone will ship in a small box for $4.99. Dresses, however, will ship in a small box at $7.95 for orders with up to 3 dresses. Orders containing more than three dresses will be upgraded to a $12.95 shipping cost. If the customer orders from both classes, the shipping will remain at the shipping cost for just the dresses. This quantity condition will not include the weight of the jewelry because we have enabled the Single Class Only option.
Pay special attention to how the rows for both shipping classes are within the same table. It is important that these rows are together in one table so that the plugin understands that all items can be shipped together. If the rows are in different tables, the method will assume it has two incomplete options, and neither option will be returned. One shipping option must cover all items in the cart, even if you are not including the shipping cost for those items.
Highest Costing Class
There are three single class only options. The default option is Highest Priority Class as discussed above. The second option is Highest Costing Class. This options works very similar to the Highest Priority option in that the condition is based only on the group of items belonging to each class. However, rather than use the shipping class’ priority, the highest shipping charge calculated among the groups is returned. This shipping charge will cover the entire order even though it is the calculation for a single class.
If we enabled this option for the above scenario, you would still receive the same outcome. The shipping method would calculate a $4.99 shipping cost for Jewelry and a $7.95 shipping cost for the dress. Because $7.95 is a higher cost than $4.99, the $7.95 price is returned as the shipping option.
The third and final option is Lowest Costing Class. It works the same as its Highest counterpart, but returns the lowest calculated cost instead.