nopSolutions/nopCommerce · error · NopException
You can't void this order
Error message
You can't void this order
What it means
Thrown by OrderProcessingService.VoidOfflineAsync when CanVoidOffline(order) returns false. An offline void is allowed only when OrderTotal > 0 and PaymentStatus == Authorized. It does not consult the payment gateway, so it only checks that the order is in an authorized (not yet captured) state with a non-zero total.
Source
Thrown at src/Libraries/Nop.Services/Orders/OrderProcessingService.cs:3096
// return false;
if (order.PaymentStatus == PaymentStatus.Authorized)
return true;
return false;
}
/// <summary>
/// Void order (offline)
/// </summary>
/// <param name="order">Order</param>
/// <returns>A task that represents the asynchronous operation</returns>
public virtual async Task VoidOfflineAsync(Order order)
{
ArgumentNullException.ThrowIfNull(order);
if (!CanVoidOffline(order))
throw new NopException("You can't void this order");
order.PaymentStatusId = (int)PaymentStatus.Voided;
await _orderService.UpdateOrderAsync(order);
//add a note
await AddOrderNoteAsync(order, "Order has been marked as voided");
//raise event
await _eventPublisher.PublishAsync(new OrderVoidedEvent(order));
//check order status
await CheckOrderStatusAsync(order);
}
/// <summary>
/// Place order items in current user shopping cart.
/// </summary>
/// <param name="order">The order</param>
View on GitHub (pinned to 64bdf2ff08)
Solutions
- Guard with: if (!_orderProcessingService.CanVoidOffline(order)) return; and report the reason.
- Verify PaymentStatus == Authorized before enabling Void; if Paid, use Refund/RefundOffline instead.
- For zero-total orders, void is not applicable.
- Disable the Void UI action once the order leaves Authorized status.
Example fix
// before
await _orderProcessingService.VoidOfflineAsync(order);
// after
if (!_orderProcessingService.CanVoidOffline(order))
return;
await _orderProcessingService.VoidOfflineAsync(order); Defensive patterns
Strategy: validation
Validate before calling
if (!_orderProcessingService.CanVoidOffline(order))
return;
await _orderProcessingService.VoidOfflineAsync(order); Prevention
- Only offer offline Void when PaymentStatus == Authorized.
- If Paid, use Refund/RefundOffline instead.
- Skip for zero-total orders.
When it happens
Trigger: Calling VoidOfflineAsync when: OrderTotal == 0; or PaymentStatus != Authorized (Paid, Voided, Refunded, Pending). Common when an admin voids an order that was already captured (Paid) or already voided.
Common situations: Order already Paid (funds captured) so an offline void is invalid; order Pending (not authorized); order already voided; zero-total order.
Related errors
- You can't refund this order
- Cannot do void for order.
- Cannot do capture for order.
- You can't mark this order as paid
- Cannot do refund for order.
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/be6cb745453cab42.
Report an issue: GitHub.