CubeCart 6.6.0 added an automated box packing algorithm for shipping rate calculation. If you sell physical goods of varying sizes, this is the feature most likely to be costing or making you money without your noticing.

The problem

Most shipping rate calculation works from total weight. That is fine if you sell one thing, and increasingly wrong as your range widens, because carriers do not price on weight alone. They price on parcel dimensions, on how many parcels there are, and frequently on volumetric weight, which is a dimension calculation dressed up as a weight.

Without dimensional awareness you have two options, and both lose money. Quote generously and you lose sales at checkout to a delivery charge that looks unreasonable. Quote tightly and you absorb the difference every time an order needs two boxes instead of one.

What CubeCart now does

New in classes/packer.class.php, this is a genuine three dimensional bin packer. You define your available box sizes in the store’s packaging list, and each product carries its dimensions and weight. When a basket needs a shipping quote, the packer works out which boxes the order actually needs.

The output per box is the box used, its dimensions, the total weight in it, and the fill ratio (used volume against box volume). Shipping modules can then quote against real parcels rather than a guess.

The algorithm

For anyone who wants to know what is actually happening: it is First Fit Decreasing with Extreme Point placement.

First Fit Decreasing means items are sorted by volume, largest first, and each is placed into the first open box it fits in. Sorting largest-first matters: big awkward items get placed while there is still room to place them well, and small items fill the gaps afterwards. Doing it the other way round is how you end up opening a second box for one large item.

Extreme Point placement means that rather than treating a box as a flat area, the packer tracks the corner points created by items already placed, and tries to seat each new item at each of those points in bottom-front-left order. Every item is tried in all six orientations at every extreme point before the packer gives up on that box and opens a new one.

When nothing open will take the item, the packer opens the smallest box from your list that qualifies. Items too large for any available box are tracked separately rather than silently dropped, which matters because that is a configuration problem you need to know about.

This class of algorithm is not guaranteed to find the mathematically optimal packing. Optimal 3D bin packing is computationally hard, and no shipping quote can afford to spend seconds on it. First Fit Decreasing with Extreme Points is the standard practical compromise, and it will comfortably beat quoting on weight alone.

What you have to do

This is the part that gets skipped, and without it the feature does nothing useful.

Define your boxes. Enter the parcel sizes you actually use into the store’s packaging list. Not the sizes you could theoretically order, the ones on the shelf. The packer can only choose from what you tell it about.

Enter product dimensions. Every product needs length, width and height as well as weight. A product with no dimensions cannot be packed sensibly. If you have a large catalogue this is a real data entry job, and it is worth prioritising: do your highest volume products first and the long tail later, rather than waiting until the whole catalogue is done before enabling anything.

Check the results before trusting them. Put a few representative baskets through checkout and see what boxes come out and what the carrier quotes. Particularly test a basket that should need two boxes, and one containing your most awkward item.

Watch for unpackable items. If a product does not fit any box in your list, you need either a bigger box in the list or a different handling rule for that product.

Related shipping changes in 6.6.0

Three other shipping improvements landed alongside it, and they address familiar frustrations:

  • Shipping priority lets you control the order in which options appear at checkout, so your preferred method is not buried below one you would rather people did not pick.
  • Cheapest method fallback: where no qualifying options exist, shipping falls back to the cheapest method rather than showing nothing.
  • Basket preserved when no shipping methods are available. Previously this situation could lose the customer’s basket, which turns a shipping configuration gap into a lost sale.

That last one is a good example of a bug fix with more commercial impact than most features.

Is it worth the setup effort?

If you sell items of broadly one size, no. Weight based rates are fine and you have better things to do.

If your basket sizes vary meaningfully, or you ship anything bulky-but-light where volumetric weight bites, or you regularly find orders needing more than one parcel, then yes. The data entry is a one-off and the accuracy is permanent.

If you host your CubeCart store with us and want a hand working out whether your product range justifies it, or setting up your box list, get in touch.

Copyright Havenswift Hosting 2007-2026. All rights reserved.