Magento Custom Shipping Part 2: Order Handling Fees

So now that we've built the basic framework for a custom shipping module in Magento Custom Shipping Part 1, its now time to move on to the special business logic that my client needs.

My client isn't shipping the usual pre-packaged electronics and other consumer goods you usually find online. Instead, they ship a product priced in standard units of volume. And since shipping is by semi truck, there's a maximum and minimum quantity that can be shipped.

Setting the Maximum and Minimum are fairly easy using the built-in Cart and Product tools from Magento. But now we need to calculate shipping costs. My client's shipping is calculated using this simple formula:

Quantity of Material x Handling Fee (per unit) + Delivery Charge (per region)

The first part of this, the handling fee, is pretty easy. Read More to see how we add the handling charges to our module

Magento Custom Shipping Part 1: Build a Custom Shipping Module

I am developing an ecommerce site in Magento, when I ran into a wall with the built-in shipping system. To be fair, Magento's shipping is incredibly robust, with a lot of add-on plugins to provide any missing requirements. However, like many small businesses, my client has some very unique needs and business logic, which means there is no off-the-shelf solution for their particular scenario. In this case, they needed a custom shipping solution. The product is delivered in bulk by semi truck, and different local delivery areas have different pricing structures. Naturally, hooking into Fedex or UPS shipping systems would not fit the bill.

Read on for a tutorial on how to build a custom shipping module.