Skip to content

Repository files navigation

Auspost / Australia Post Magento 2 Extension by Web Hosting Ace

Australia Post shipping rates (PAC API) for Magento 2, with a real box packing algorithm. Standalone extension — carrier code auspost. Developed and maintained by Web Hosting Ace.

Features

  • Multi-box packing into your actual cartons, validated by an axis-aligned shelf/layer arrangement check against the configured box dimensions — pure volume maths would accept impossible fits; per-package rates requested and summed
  • JSON PAC API with responses cached in Magento cache (default 24h)
  • Domestic + international parcel and letter services, signature-hide and extra cover options
  • Extra Cover insures each package for the value of the products packed into it; admin validation prevents enabling Extra Cover while Signature on Delivery is hidden, since Australia Post only sells cover above $500 with a signature
  • Constructor DI throughout, strict types, one product collection query per quote — no per-item loads
  • No licensing or phone-home code

Standalone extension

On install the module creates the product attributes it needs (skipped individually if an attribute already exists):

Attribute code Purpose
auspost_length Product length in cm
auspost_width Product width in cm
auspost_height Product height in cm
auspost_package_type Parcel (default) or Letter

The three dimension attributes are pre-selected in the Product Dimensions config. Products with empty values fall back to the configured default dimensions (10 cm each by default). Any other numeric attribute can be selected instead.

If any other extension using the carrier code auspost was previously installed, disable it first — two active carriers cannot share a code.

Requirements

  • Magento Open Source / Adobe Commerce 2.4.4 or later
  • PHP 8.1 or later (use the PHP version supported by your Magento release, per the table below)
  • An Australia Post PAC API key — free registration at developers.auspost.com.au
Magento Supported PHP
2.4.4 / 2.4.5 8.1
2.4.6 8.2, 8.1
2.4.7 8.3, 8.2
2.4.8 8.4, 8.3
2.4.9 8.5, 8.4

Magento 2.3 and earlier are end-of-life and not supported.

Rates are Australia Post retail (PAC) rates. Contract/eParcel negotiated rates are not supported.

Installation

Composer (recommended)

composer require webhostingace/module-auspost
php bin/magento module:enable WebHostingAce_Auspost
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

Updating later:

composer update webhostingace/module-auspost
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

Manual (app/code)

mkdir -p app/code/WebHostingAce/Auspost
# copy module files there

php bin/magento module:enable WebHostingAce_Auspost
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

Use one method or the other — if a copy exists in app/code, it overrides the Composer copy in vendor and Composer updates will appear to have no effect.

Configuration

Stores → Configuration → Sales → Delivery Methods → Australia Post (WebHostingAce)

Box Packing (the important part)

Define your real cartons/satchels under Available Boxes: name, outer dimensions in cm, maximum content weight and empty-box (tare) weight in kg. Example set:

Box L W H Max kg Tare kg
Small Satchel 22 16 7 0.5 0.02
Small Box 22 16 10 5 0.10
Medium Box 30 22 15 10 0.20
Large Box 43 30 20 22 0.45

Enter outer carton dimensions — they are what Australia Post prices on. Wall thickness and packing material are absorbed by the Fill Factor (default 90% of volume usable).

Packing strategy per rate request:

  1. If all items fit one box, use the smallest box that holds them.
  2. Otherwise fill the largest suitable box greedily (largest items first) and repeat.
  3. Each resulting package is then downsized to the smallest box that holds its contents.
  4. Items that fit no box ship as their own package with their own dimensions.
  5. With no boxes defined, the whole cart is quoted as a single bounding package (legacy behaviour).

Constraints checked per box: rotation-aware dimensional fit, usable volume (× Fill Factor), max content weight, and an axis-aligned shelf/layer arrangement check against the configured box dimensions — pure volume maths would happily put two 6 cm cubes into a 10 cm cube; this module will not. Note the check uses the dimensions as entered (outer), so allow for wall thickness when configuring tight-fitting cartons. The check is deliberately conservative: borderline carts may split into one more box rather than risk an impossible fit. AusPost is quoted once per distinct package size/weight/value and each service's price is summed across packages. A service is only offered when it is available for every package.

Handling Applied = Per Package applies your handling fee once per packed box.

Debugging

Enable Debug Logging to see packing results and raw API traffic in var/log/debug.log:

[Auspost] Package 1: Medium Box (30.0x22.0x15.0@3.100), 4 item(s)

After changing AusPost list prices (or your API key), flush the cache tag: php bin/magento cache:flush (responses use the WEBHOSTINGACE_AUSPOST tag, TTL configurable, default 86400s).

Notes

  • The store base currency should be AUD for Australian stores. On other base currencies the module converts AusPost's AUD rates using your configured currency rates; without an AUD rate, no rates are returned (a warning is logged).
  • Dimensions are always centimetres; weight is converted to kg from the module's Weight Unit setting (kilograms, grams or pounds — this setting is authoritative over the store locale unit).
  • Products with decimal quantities (sold by weight/length) keep their fractional weight; partial quantities ship as one piece with proportional weight.
  • Letters: when every cart item has auspost_package_type = Letter, letter services are quoted instead of parcels (single letter, summed weight/thickness).
  • Cart-price-rule free shipping on individual items exempts those units from packing, matching core carrier behaviour.
  • The retail PAC API is rate limited by Australia Post; the built-in response cache keeps checkout traffic well under the limit.

Support

Provided as-is, without warranty or guaranteed response times. Please include your Magento version, PHP version and the relevant var/log/debug.log lines (with Debug Logging enabled) when reporting rate issues.

License

MIT — see LICENSE. Copyright (c) 2026 Web Hosting Ace.

About

Australia Post shipping rates for Magento 2 with real multi-box packing, letter services, extra cover and PAC API response caching.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages