I've created a stub/reference Adjuster module, here.
This demonstrates how to register two Adjusters via a custom module—one that creates a 5% discount on each line item, and one that creates a 10% discount on the entire order.
These adjusters have their logic hard-coded, which is to say: in order to modify the behavior/value of the adjustments, you have to change PHP files. Part of the benefit of Craft's built-in adjusters (Taxes, Discounts) is that they base their calculations on input from the merchant/admin, in the control panel.
You can replace the two calls to
$adjustment->amount = $myAmount; with anything you like—including Craft API calls that fetch values off of Elements, get plugin or environment settings, inspect
LineItem options, etc.
This is where Adjusters become immensely powerful. As long as you can provide a positive or negative value, a label, and a description for your
Adjustment, it doesn't matter how you derive it. ✌️
This module is not meant to be installed as a plugin, or used as a submodule—it's probably best to just lift the code out and replace the generic classes and namespaces.
A bit of context: James and I spoke in Slack earlier today, which prompted the creation of this repo. The code has been adapted from private projects, but is now available under the MIT license.