Skip to main content
Shipping extensions calculate delivery costs and provide shipping options to customers during checkout. They integrate with your store to offer various shipping methods based on weight, location, price, or other factors.

What Are Shipping Extensions?

Shipping extensions are specialized controllers that:
  • Calculate shipping costs based on various criteria
  • Provide available shipping options during checkout
  • Support geo-zone restrictions
  • Handle special shipping rules and conditions
  • Display delivery time estimates
Shipping extensions are located in upload/extension/[vendor]/admin/controller/shipping/

Built-in Shipping Methods

OpenCart includes five basic shipping methods:

Flat Rate

Fixed shipping cost regardless of order size or weight

Free Shipping

No shipping charge, ideal for promotions

Per Item

Shipping cost calculated per item quantity

Pickup

In-store or local pickup option with no shipping

Weight-Based

Cost based on total order weight with tiered pricing

Shipping Extension Architecture

Admin Controller

Location: admin/controller/extension/[vendor]/shipping/[name].php
Location reference: admin/controller/extension/opencart/shipping/flat.php:1

Catalog Controller (Shipping Quote)

Unlike payment extensions, shipping extensions don’t have a separate catalog controller file. Instead, they’re called through the shipping model system: Location: catalog/model/extension/[vendor]/shipping/[name].php

Common Configuration Options

Most shipping extensions share these settings:

Status

Sort Order

Geo Zone

Tax Class

Shipping Method Examples

Flat Rate Shipping

Simplest shipping method with fixed cost:

Free Shipping

No cost shipping, often with conditions:

Per Item Shipping

Cost multiplied by quantity:

Weight-Based Shipping

Tiered pricing based on weight:

Multiple Shipping Options

A single shipping extension can provide multiple shipping options:

Geo-Zone Restrictions

Limit shipping methods to specific regions:

Developing Custom Shipping Extensions

Admin Configuration Controller

Shipping Quote Model

Quote Data Structure

The getQuote() method must return an array with specific keys for OpenCart to display shipping options correctly.

Return Format

Error Handling

Best Practices

Cache API Calls

Cache shipping rate API calls to improve checkout performance

Handle Errors

Gracefully handle API failures and provide fallback options

Clear Naming

Use descriptive names for shipping options (include delivery time)

Test Geo Zones

Thoroughly test geo zone restrictions with various addresses

Troubleshooting

Shipping Method Not Appearing

  1. Check status: Is the shipping method enabled?
  2. Check geo zone: Is customer’s location within allowed zones?
  3. Check requirements: Does order meet minimum requirements (weight, subtotal, etc.)?
  4. Check return value: Is getQuote() returning proper array structure?

Incorrect Shipping Cost

  1. Check calculations: Verify weight, quantity, or distance calculations
  2. Check tax class: Ensure correct tax class is applied
  3. Check currency: Verify currency conversion if applicable
  4. Debug values: Log variables to check calculation steps

Next Steps