Afform Order

Development Status
Stable
Active Installs
Maintainers
Download

Last updated: 2026-10-08

Works with CiviCRM 6.16 or higher.

Payments and Refunds

Afform Order adds an editable, in-form line-item cart to Afform forms, so staff can build a new order or edit an existing contribution's line items directly from a form — while keeping Afform's existing checkout/payment flow intact.

It is processor-agnostic and contains no business rules: it's a reusable engine that consumer extensions build their own pricing, membership, and validation policy on top of, through a set of server events and client-side registries.

What it provides

  • An editable cart input type (LineItemCart) plus Angular components for adding, editing, and removing line items on an Afform.
  • A submit pipeline that turns the cart into a new order (Order.create) or an edit of an existing one, recomputing companion line items server-side and running advisory validation checks.
  • A companion-line-item orchestrator.
  • Extension points (server events + client registries) for consumers to plug in pricing, membership, and validation logic.
  • Two ready-to-copy sample Afform layouts.

Modifying existing orders

CiviCRM core can create an order (Order.create) but has no first-class way to modify one — to add, remove, or correct line items on a contribution that already exists, and to do so correctly when that contribution has already been paid (reversing lines and booking an accounts-receivable adjustment rather than destructively editing financial history). Afform Order fills that gap with the OrderAO API4 entity (most centrally OrderAO.modify), which the add/edit UI is built on. This was the extension's original purpose; the Afform admin UI was then built on top of it.

Relationship to CiviCRM core

The modify engine is intended as a stand-in for a capability that belongs in core. OrderAO is named deliberately to sit beside core's existing Order entity without colliding, with the intent that OrderAO.modify eventually converges with — and is replaced by — a core Order.modify. If core gains that, what remains here is the Afform add/edit UI (the cart, components, and submit pipeline), repointed to the core action. This is a deliberate design choice, not a limitation: until core offers an equivalent, this extension carries the whole capability, and consumers can depend on OrderAO/OrderLineItem as a stable public surface.

Requirements

CiviCRM 6.16+, plus the Afform and Contribute core components. A configured payment processor is needed for the live checkout half of the create flow.