nopSolutions/nopCommerce · warning · Exception

Enter ready for pickup date

Error message

Enter ready for pickup date

What it means

Thrown in the OrderController shipment 'ready for pickup' action when model.ReadyForPickupDateUtc is null. Mirrors the shipped/delivery date handlers: the action requires an explicit pickup-ready timestamp before persisting. Base Exception, caught, shown via ErrorNotificationAsync, redirect back to shipment details.

Source

Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/OrderController.cs:2284

    [HttpPost, ActionName("ShipmentDetails")]
    [FormValueRequired("savereadyforpickupdate")]
    [CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]
    public virtual async Task<IActionResult> EditReadyForPickupDate(ShipmentModel model)
    {
        //try to get a shipment with the specified id
        var shipment = await _shipmentService.GetShipmentByIdAsync(model.Id);
        if (shipment == null)
            return RedirectToAction("List");

        //a vendor should have access only to his products
        if (await _workContext.GetCurrentVendorAsync() != null && !await HasAccessToShipmentAsync(shipment))
            return RedirectToAction("List");

        try
        {
            if (!model.ReadyForPickupDateUtc.HasValue)
                throw new Exception("Enter ready for pickup date");

            shipment.ReadyForPickupDateUtc = model.ReadyForPickupDateUtc;
            await _shipmentService.UpdateShipmentAsync(shipment);
            return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
        }
        catch (Exception exc)
        {
            await _notificationService.ErrorNotificationAsync(exc);
            return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
        }
    }

    [HttpPost, ActionName("ShipmentDetails")]
    [FormValueRequired("setasdelivered")]
    [CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]
    public virtual async Task<IActionResult> SetAsDelivered(int id)
    {
        //try to get a shipment with the specified id

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Provide a ready-for-pickup date before submitting.
  2. Confirm ReadyForPickupDateUtc is present and parseable in the POST body.
  3. Add client-side required validation on the pickup date input.
  4. Optionally default to DateTime.UtcNow when the field is empty instead of throwing.

Example fix

// before
if (!model.ReadyForPickupDateUtc.HasValue)
    throw new Exception("Enter ready for pickup date");
shipment.ReadyForPickupDateUtc = model.ReadyForPickupDateUtc;

// after — default to now when omitted
shipment.ReadyForPickupDateUtc = model.ReadyForPickupDateUtc ?? DateTime.UtcNow;
await _shipmentService.UpdateShipmentAsync(shipment);
Defensive patterns

Strategy: validation

Validate before calling

// Before marking ready-for-pickup: ensure a date, defaulting to now
if (!model.ReadyForPickupDateUtc.HasValue)
    model.ReadyForPickupDateUtc = DateTime.UtcNow;
shipment.ReadyForPickupDateUtc = model.ReadyForPickupDateUtc;

Type guard

bool HasPickupDate(ShipmentModel m) => m.ReadyForPickupDateUtc.HasValue;

Try / catch

// The action's try/catch shows the exception via ErrorNotificationAsync; require the date client-side.

Prevention

When it happens

Trigger: POST to set a shipment 'ready for pickup' with ReadyForPickupDateUtc absent or null in the request.

Common situations: The ready-for-pickup date field left blank; form customization dropped the field; an integration call omitting the date; a date-picker locale/format issue yielding empty on post.

Related errors


AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13). Data as JSON: /api/errors/c473897255d6814b. Report an issue: GitHub.