Registering like so and all is well.
Event::on(
OrderAdjustments::class,
OrderAdjustments::EVENT_REGISTER_ORDER_ADJUSTERS,
function(RegisterComponentTypesEvent $event) {
$event->types[] = Freebie::class;
}
);
Per the docs (bolds mine):
Each of those models may be applied to the order or one of its line items.
An adjustment model always belongs to an order, but can optionally belong to a line item.
We've set up according to this [example here][1] which demonstrates looping through line items and adding the adjuster to each item. All good so far.
But how might we add an adjuster to only the order?
If we take the adjustment code out of the loop )as in the example linked above) and leave off the $adjustment->setLineItem($item);
, the model does not appear in cart.adjustments
nor cart.orderAdjustments
Craft CMS 3.7.50 [PRO]
Commerce 3.4.15 [PRO]
[1]: https://craftcms.com/docs/commerce/3.x/extend/adjusters.html#designating-an-order-and-line-item