Download the PHP package justinholtweb/craft-weight without Composer

On this page you can find all versions of the php package justinholtweb/craft-weight. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft-weight

Weight

Weight-based shipping rates for Craft Commerce 5 — tiered per-weight pricing, handling fees, destination and subtotal conditions, box packing and dimensional weight.

It is a Craft-native answer to WooCommerce's Weight Based Shipping: the same rule model store owners already know, plus the packing engine that plugin never had and a simulator that shows you every number behind a price.

What it does

Each method you create appears at checkout as its own shipping option. Behind it is an ordered list of rules, and every rule that matches contributes to the price:

A 6kg order comes to 17.60: `3.50 + 4.50 + (6 − 2 = 4kg → 8 × 0.5kg steps @ 1.20) = 3.50 + 4.50

Conditions a rule can carry

What a rule can charge

A flat handling fee, a cost per unit of weight (continuous or in whole steps, after a free allowance), a cost per item, a percentage of the subtotal, and its own minimum and maximum. There are per-shipping-category overrides too — frozen goods at a higher rate per kilo than dry goods.

What a rule can do instead of charging

Packing

Tell a method how the cart becomes parcels:

Then tell it whether to rate the cart as a whole or rate each parcel and add the results up — which is how a per-parcel carrier price gets modelled honestly.

Dimensional weight: give a method a divisor and each package is billed on the heavier of its real weight and length × width × height ÷ divisor.

Price

$59, with a $49/year renewal for updates. One edition — everything below is in it. There is no free tier and no feature you can buy your way into later.

Methods and ordered rules ✓
All four charge components, clamps, free / disable / required / stop ✓
Weight, subtotal, quantity, destination, postal-code, category conditions ✓
Craft condition-builder rules ✓
Split by maximum package weight ✓
Box packing and per-package rating ✓
Dimensional weight ✓
Per-shipping-category charges ✓
Carrier rate presets, and Postie support ✓
Simulator, Twig variable, cart API, console commands, export and import ✓

Carriers and Postie

Weight ships importable presets shaped like the common carriers' own rate structures — Royal Mail, UPS Ground, FedEx Home, USPS Priority (both flat-rate and by weight), DHL Express and Australia Post. Every amount in them is a placeholder. The structure is the tedious part and it rarely changes; the numbers are the part you already have on a contract, and republishing a carrier's rate card would be both somebody else's copyright and stale within a quarter.

Where Postie is installed alongside, two things happen on their own:

Weight never edits Postie's prices. Exactly one plugin computes any given total.

Requirements

Craft CMS 5.3+, Craft Commerce 5.0+, PHP 8.2+. Postie is optional and is not a dependency.

Installation

Templating

craft.weight.quotes(order = cart) every method's price, cheapest first, keyed by handle
craft.weight.quote(handle, order = cart) one method's price
craft.weight.packages(handle, order = cart) how the cart would be packed
craft.weight.progress(order = cart) how far the cart is from free shipping

JSON

GET /actions/weight/cart/quote returns the same numbers for the requester's own cart, along with the free-shipping progress. Anonymous, because it only ever describes your own basket.

Console

Methods, rules and boxes live in the database rather than project config — the same call Commerce makes for its own shipping methods — so export and import are how they move between environments. docs/example-config.json is a working example.

How it decides

Two invariants hold the plugin together:

  1. services\Rater::quote() is the only place a price is computed. The Commerce shipping method, the simulator, the cart API and the console all read the same Quote, so a preview can never disagree with a checkout.
  2. services\Packer::pack() is the only place a cart becomes packages.

Both memoize on a full cart signature — items, quantities, weights, prices, address, coupon — never on the order number alone, which would answer a recalculated cart from a stale quote.

Line items that are non-shippable or already carry free shipping are excluded from packing, so the weight being charged for is the weight actually being shipped.

About the box packer

Three-dimensional bin packing is NP-hard and nobody solves it exactly at checkout. Weight's packer is first-fit-decreasing with a volume-and-dimension fit test: an item goes in a box if each of its dimensions fits the box's, the box has volume left and the box has weight left. It does not model the geometry of what is already in the box, so it errs towards more boxes rather than fewer — the direction that overcharges no carrier — and every decision it makes is visible in the simulator.

Documentation

justinholt.com/plugins/craft-weight/docs — Installation, Configuration, Usage, Troubleshooting and the FAQ. The same pages live in docs/ in this repository, which is where they are authored.

Support

[email protected]

Trademarks

Weight is an independent plugin built by Justin Holt. It is not affiliated with, endorsed by, or sponsored by Automattic Inc., Verbb, or any shipping carrier.

“WooCommerce” is a trademark of Automattic Inc., used here only to identify the rule model Weight is modelled on. “Postie” is a trademark of Verbb, used here only to identify the plugin Weight can run alongside. Carrier and service names — Royal Mail, UPS, FedEx, USPS, DHL, Australia Post — are trademarks of their respective owners and are used only to identify the rate structures the presets mirror. No preset contains any carrier's published rates.

Licence

Proprietary. See LICENSE.md.


All versions of craft-weight with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
craftcms/cms Version ^5.3.0
craftcms/commerce Version ^5.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package justinholtweb/craft-weight contains the following files

Loading the files please wait ...