Weight for Craft CMS

Installation

Requirements

  • Craft CMS 5.3 or later
  • Craft Commerce 5.0 or later
  • PHP 8.2 or later

Weight is a Commerce plugin. It registers a shipping method per method you create and computes prices during Commerce's own order recalculation — there is nothing to install on the front end.

Install

composer require justinholtweb/craft-weight
php craft plugin/install weight

Or find Weight in the Craft Plugin Store and install it there.

Installing creates three tables — weight_methods, weight_rules and weight_boxes — and adds a Weight item to the control panel navigation.

What you get

$59, with a $49/year renewal for updates. One edition — there is no free tier, no trial, and nothing held back for a higher one.

Methods and ordered rules
Flat, per-weight, per-item and percentage charges, with clamps
Free / unavailable / required / stop rule actions
Weight, subtotal, quantity, destination, postal-code and category conditions
Craft condition-builder rules
Split by maximum package weight
Box packing and per-package rating
Dimensional weight
Per-shipping-category charge overrides
Carrier rate presets, and Postie support
Simulator, Twig variable, cart API, console commands, export and import

The renewal buys updates, not the right to keep running it: an expired licence keeps working on the version you already have.

Your first method

  1. Go to Weight → Methods and press New method.
  2. Give it a name and a handle — standard — and a customer label, which is the text shoppers see at checkout.
  3. Save. The method now exists but has no rules, so it charges nothing and, with the default setting, is not offered at all.
  4. Press New rule and add the simplest useful one:

    FieldValue
    NameBase rate
    Flat cost4.50
    Cost per unit of weight1.20
  5. Save, then open Weight → Simulator, enter a weight, and press Quote. You will get a price and, underneath it, every rule that matched and every step of the arithmetic.

Checking it at checkout

Weight's methods appear alongside Commerce's own in cart.availableShippingMethodOptions, so an existing checkout template needs no changes. If you want Weight's own numbers — package counts, free-shipping progress — use the craft.weight variable described in Usage.

Settle the weight unit first

Product weights are stored in whatever Commerce's weightUnits setting says — Commerce → System Settings → General, or weightUnits in config/commerce.php. It defaults to grams.

Every weight you type into a Weight rule, box or method is in that same unit, and the control panel prints the unit next to each of those fields so there is no guessing. Changing weightUnits later does not convert anything you have already entered, so settle on the unit before you build a rate table — otherwise a 2 that meant two kilograms starts meaning two grams.

Permissions

Three permissions are registered under Weight in the user group settings:

  • Manage weight-based shipping methods — the Methods screens
  • Manage packing boxes — the Boxes screens
  • Use the simulator — the Simulator

The plugin's own settings screen remains admin-only, as Craft requires.

Uninstalling

php craft plugin/uninstall weight

The three tables are dropped. Export first if you want to keep the configuration:

php craft weight/methods/export --file=weight.json