commerce_order_amend
Commerce Order Amend adds an "Amend Order" tab to placed Commerce orders, giving back-office staff a guided interface for post-placement order modifications.
Commerce core allows raw entity editing on orders but lacks the business logic around amendments: price protection, order refresh on placed orders, audit logging with SKUs, balance difference calculation, payment guidance, and event-driven extensibility for other modules to react.
Features
- Swap item variations (same product or cross-product)
- Add or remove order items
- Add or remove coupons
- Unit price override with currency locked to the order's currency
- Price protection: all item prices are locked during refresh, preserving original checkout pricing
- Refresh change detection: warns staff about unexpected side effects (promotions added/removed, tax recalculations) with a link to the order edit form
- Payment balance tracking with actionable guidance (collect payment or issue refund)
- Commerce Log audit trail prefixed with "Order Amended" for easy identification, including SKUs and reasons
- Stock validation (optional, respects always-in-stock flag, requires Commerce Stock)
- Configurable editable states via admin UI
- Amendment types tracking field for Views filtering (which orders were swapped, had items added, etc.)
- Event-driven architecture: dispatches OrderAmendEvent so other modules can react (stock adjustments, MTO sync, notifications, ERP integration)
Requirements
- Drupal 10 or 11
- Commerce 2.x or 3.x
Optional
- Commerce Stock — for stock availability validation
How It Differs from Core Order Editing
Concern Commerce core edit form Commerce Order Amend Edit order items Yes (raw entity form) Yes (guided form) Order refresh on placed orders No Yes (forces recalculation) Price protection No Yes (locks all item prices, preserves original checkout pricing) Unit price override Manual field editing Integrated field with currency locked to order Refresh side effect detection No Yes (warns about unexpected changes) Variation swap detection No (stock unaware) Yes (handles stock for old and new) Audit log (who, what, why, SKU) No Yes (Commerce Log) Payment balance alert No Yes (shows difference with link to Payments) State-based access No Yes (configurable) Event dispatch No Yes (OrderAmendEvent) Stock validation No Yes (optional, respects always-in-stock) Amendment tracking for Views No Yes (multi-value field per operation type)Known Limitations
Order Refresh on Placed Orders
Commerce core deliberately skips OrderRefresh on placed (non-draft) orders because the refresh pipeline can be destructive. This is tracked in #2875804: Order Refresh should work for non-draft orders, too: Order Refresh should work for non-draft orders, too.
This module forces a full order refresh after every amendment via setRefreshState(REFRESH_ON_SAVE). To mitigate the risks, it:
- Locks all item prices before refresh (sets
overridden_unit_priceon all items, preserving original checkout pricing) - Detects side effects by comparing order state before/after refresh
- Warns staff about any unexpected changes with a link to the order edit form
Despite these mitigations, some side effects cannot be prevented:
- Expired or usage-limited promotions may be removed or re-applied by the promotion processor
- Tax rules that changed since the order was placed will apply the current rates
- Availability checkers may flag items as unavailable
If Commerce core lands a selective refresh API, this module will adopt it to allow more granular control over which processors run during amendments.