Search Knowledge Base by Keyword

WooCommerce UPS Shipping – Add Extra Fees Based on Box Size

In this article, we will tell you how to add extra fees based on the box size when using the WooCommerce UPS Shipping Plugin with Print Label. Read below to know more about it.

David runs an eCommerce store where he sells tropical fruits. Shipping of perishable goods becomes a tricky task since he has to take special care of its packing. The seller has to guarantee that the fruits that reach the customer are of the promised quality. Each fruit might require a box of a different type and size. Consequently, the boxes would have different rates too. Not willing to take chances, he decides to use expensive boxes for shipping his fruits.

Shipping perishable goods need expensive boxes of varied sizes – How to account for the extra cost?

The root cause of the problem is that expensive boxes of different sizes are required to ship perishable goods. David has to figure a way to account for this extra cost.

Moreover, the size of the box would also depend on the number of fruits it is meant to carry. Accordingly, David would require to attach a special cost to his packages based on the box size.
Now, the standard UPS API doesn’t allow this flexibility.

But, PluginHive has a solution for this.

WooCommerce UPS Shipping solution of PluginHive allows charging of extra fees based on the box sizes

With the below code snippet, David would be able to add extra costs based on the box sizes.

https://gist.githubusercontent.com/xadapter/9daa3dfdf0172b06f69942749f531b9e/raw/7ac1c7c85d301d4b9022d08f59f0f7de14b73c44/function.php

As you can see below, the highlighted part denotes the box dimensions and the corresponding fees associated with it. The part can be modified as per the user’s requirements. This extra cost would be added to the shipping charges.

woocommerce debug

Here’s an example, before adding the above code snippet, the shipping rates are as follows –
shipping rate

After adding the code snippet, as per the selected box (In this case, the second box is selected), $15 is added to every shipping services –
ups shipping rates

Last Updated On September 25, 2018