Opencart 4 tutorial · 6 min read · Updated

Weight-Based Shipping in OpenCart 4 and 3: Setup, Rate Format and What We Found Testing

A step-by-step guide to OpenCart weight-based shipping, with the rules behind the rate format and tested checkout results from OpenCart 4.1.0.4 and 3.0.5.1.

Opencart weight based shipping

A flat $5 shipping rate is easy to set up and wrong for most stores. You lose money every time someone orders a heavy monitor, and you overcharge everyone who buys a phone case. Carriers charge by weight, so your checkout should too.

OpenCart has weight-based shipping built in. It’s a core extension called Weight Based Shipping, and it works the same way in OpenCart 4 and OpenCart 3. It’s also easy to get wrong: the rate format is a single line of text, and a few rules about how it reads that line aren’t explained anywhere in the admin. We set it up on OpenCart 4.1.0.4 and 3.0.5.1, ran carts of different weights through checkout, and wrote down exactly what happened.

How weight-based shipping works in OpenCart

You give OpenCart a list of weight tiers and a price for each tier, per geo zone:

1:5.00,5:9.50,10:14.00,20:22.00,30:30.00

Read it as “up to 1 kg costs $5.00, up to 5 kg costs $9.50, up to 10 kg costs $14.00”, and so on. At checkout OpenCart adds up the cart weight and walks through the list from left to right. The first tier whose weight is equal to or greater than the cart weight sets the price. Here’s the core code that does it, from OpenCart 4.1.0.4:

$rates = explode(',', $this->config->get('shipping_weight_' . $result['geo_zone_id'] . '_rate'));

foreach ($rates as $rate) {
    $data = explode(':', $rate);

    if ($data[0] >= $weight) {
        if (isset($data[1])) {
            $cost = $data[1];
        }
        break;
    }
}

Three rules follow from that loop, and they cause most setup problems:

  • Tiers must be in ascending order. OpenCart doesn’t sort them. If you write 10:14.00,1:5.00, every cart up to 10 kg pays $14.00.
  • The weight is “up to and including”. A cart of exactly 1 kg pays the 1 kg price.
  • Heavier than the last tier means no option at all. If the cart weighs more than your last tier, weight-based shipping simply disappears from checkout for that zone. Always end with a tier bigger than any order you’ll get.

Step 1: Check your weight class and product weights

The tiers use your store’s default weight class. Check it in System > Settings > edit your store > Local > Length Class / Weight Class. The demo store uses Kilogram.

Every product that ships needs a weight. Edit a product, open the Data tab and fill in Weight and Weight Class. OpenCart converts each product to the default class, so a product entered in grams works fine in a kilogram store. In our test the HTC Touch HD is entered as 146.4 grams and checkout showed it as 0.15 kg.

Also check Requires Shipping on the same tab. Products set to No, like the demo MacBook, add nothing to the shipping weight. Option values can add or subtract weight too, with the + and – weight fields on the product’s Option tab, and the weight is multiplied by the quantity.

Step 2: Create a geo zone for the area you ship to

Weight-based rates are set per geo zone, so you need one for each area with its own prices. OpenCart’s demo data only has UK geo zones, so we added one for the United States.

  1. Go to System > Localisation > Geo Zones and click the blue +.
  2. Enter a Geo Zone Name, such as “United States”, and a Description.
  3. Click the blue + under the zone table, pick United States as the country and All Zones as the zone.
  4. Save.
Add Geo Zone form in OpenCart 4 with the name United States, the description All US states, and one row with the country United States and the zone All Zones
A geo zone that covers every US state.

For different prices to different regions, such as the lower 48 versus Alaska and Hawaii, create a geo zone for each and give each one its own tiers in step 4.

Step 3: Install Weight Based Shipping

  1. Go to Extensions > Extensions and choose Shipping in the filter.
  2. Find Weight Based Shipping and click the green + (Install).
  3. Click the blue pencil to edit it.
OpenCart 4 shipping extensions list with Flat Rate and Store Pickup enabled and Weight Based Shipping installed but not yet enabled
After installing, Weight Based Shipping stays grey until you enable it.

OpenCart 3 uses the same menu: Extensions > Extensions, choose Shipping, then Install and Edit.

Step 4: Enter the rates

The edit page has a General tab and one tab per geo zone.

  1. On the General tab, choose a Tax Class if shipping is taxed in your country, turn Status on, and set a Sort Order (lower numbers show first at checkout).
  2. Open the tab for your geo zone, here United States.
  3. Enter the tiers in Rates: 1:5.00,5:9.50,10:14.00,20:22.00,30:30.00. No spaces, no currency signs.
  4. Turn the geo zone’s Status on. A zone with its status off never shows the method, even if it has rates.
  5. Save.
Weight Based Shipping edit page in OpenCart 4 on the United States tab with rates 1:5.00,5:9.50,10:14.00,20:22.00,30:30.00 and status on
Tiers for the United States geo zone in OpenCart 4.
Weight Based Shipping edit page in OpenCart 3 on the United States tab with the same rates and status Enabled
The same screen in OpenCart 3.0.5.1.

Prices are in your default currency. If you sell in several currencies, OpenCart converts the shipping price like any other price.

Step 5: Test it at checkout

Log in as a customer with an address inside the geo zone, add products to the cart and go to checkout. Weight Based Shipping appears next to your other methods, with the zone name and the cart weight in the label.

OpenCart 4 checkout shipping method options listing store pickup, Flat Shipping Rate 5 dollars and Weight Based Shipping United States Weight 20.20kg 30 dollars
OpenCart 4 checkout with two iPhones: “United States (Weight: 20.20kg) – $30.00”.
OpenCart 3 checkout delivery method step listing Flat Rate, Store Pickup and Weight Based Shipping United States Weight 20.00kg 22 dollars
OpenCart 3 checkout with the same cart: “United States (Weight: 20.00kg) – $22.00”.

What we found when testing

The demo products have handy weights: the HTC Touch HD is 146.4 g, the HP LP3065 monitor is 1 kg, the Samsung SyncMaster 941BW is 5 kg, and the iPhone is, oddly, 10 kg. On OpenCart 3.0.5.1 the results matched the tiers exactly:

CartWeight shownPrice
HTC Touch HD0.15 kg$5.00
HP LP30651.00 kg$5.00
Samsung SyncMaster 941BW5.00 kg$9.50
1 iPhone10.00 kg$14.00
2 iPhones20.00 kg$22.00
3 iPhones30.00 kg$30.00

That confirms the “up to and including” rule: exactly 1 kg paid the 1 kg price and exactly 30 kg still got the last tier.

OpenCart 4.1.0.4 gave different numbers for the same carts, and the reason is worth knowing:

CartWeight shownPrice
HTC Touch HD0.35 kg$5.00
HP LP30651.20 kg$9.50
Samsung SyncMaster 941BW5.20 kg$14.00
4 × HP LP30654.20 kg$9.50
1 iPhone10.20 kg$22.00
2 iPhones20.20 kg$30.00
3 iPhones30.20 kgNo weight-based option

Every cart was 0.2 kg heavier. The OpenCart 4 test store runs a free-gift extension that adds a tote bag to any cart over $100, and the tote bag has a weight of 0.2 kg. That small gift pushed the 1 kg monitor into the next tier, and it pushed three iPhones over the 30 kg limit, so weight-based shipping vanished from checkout.

The lesson applies to any store: everything in the cart with Requires Shipping set to Yes counts, including free gifts, samples and bundled items. Give free gifts a weight of 0 or set them to not require shipping if you don’t want them to change the price, and always end your rates with a tier bigger than your largest realistic order, such as 999:60.00.

Common problems

  • Weight Based Shipping doesn’t show at checkout. Check that the extension’s Status is on, that the geo zone tab’s Status is on, that the customer’s address is inside that geo zone, and that the cart isn’t heavier than your last tier.
  • Every order gets the same price. Your products probably have a weight of 0. The label shows the cart weight, so “Weight: 0.00kg” gives it away.
  • Prices are too high for small items. Check the product’s weight class. A product entered as 500 with the class set to Kilogram instead of Gram weighs half a ton.
  • Two weight options appear. The address matches two geo zones that both have rates enabled. Each matching zone is shown as its own option.

Please let us know if you have any questions or suggestions, and subscribe to our YouTube channel for more OpenCart video tutorials. You can also find us on Twitter and Facebook.

Rupak Nepali
Written byRupak Nepali

Rupak Nepali is a web developer, manage Webocreation website and the author of six books:
Getting Started with OpenCart Module Development (Packt, 2013),
OpenCart Theme and Module Development (Packt, 2015),
OpenCart 4: Dev Guide for Themes & Extensions (2024),
OpenCart 4: User Manual (2025),
Cloudflare for the Enterprise Website (2026) and
The Technical Web Guide for Marketers (2026).
Rupak has built OpenCart stores and extensions since 2010, has published more than 600 tutorials on Webocreation, and shares free OpenCart extensions on GitHub.
Find Rupak on
GitHub | Amazon | LinkedIn | X | YouTube.

Leave a Reply

Your email address will not be published. Required fields are marked *