{"record":{"id":"95a8494ad7f66936","repo":"nopSolutions/nopCommerce","slug":"this-shipment-is-can-t-be-shipped-the-order-has-b","errorCode":null,"errorMessage":"This shipment is can't be shipped. The order has been placed with 'pickup in store' shipping option.","messagePattern":"This shipment is can't be shipped\\. The order has been placed with 'pickup in store' shipping option\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/Orders/OrderProcessingService.cs","lineNumber":2241,"sourceCode":"            return false;\r\n\r\n        return true;\r\n    }\r\n\r\n    /// <summary>\r\n    /// Send a shipment\r\n    /// </summary>\r\n    /// <param name=\"shipment\">Shipment</param>\r\n    /// <param name=\"notifyCustomer\">True to notify customer</param>\r\n    /// <returns>A task that represents the asynchronous operation</returns>\r\n    public virtual async Task ShipAsync(Shipment shipment, bool notifyCustomer)\r\n    {\r\n        ArgumentNullException.ThrowIfNull(shipment);\r\n\r\n        var order = await _orderService.GetOrderByIdAsync(shipment.OrderId) ?? throw new Exception(\"Order cannot be loaded\");\r\n\r\n        if (order.PickupInStore)\r\n            throw new Exception(\"This shipment is can't be shipped. The order has been placed with 'pickup in store' shipping option.\");\r\n\r\n        if (shipment.ShippedDateUtc.HasValue)\r\n            throw new Exception(\"This shipment is already shipped\");\r\n\r\n        shipment.ShippedDateUtc = DateTime.UtcNow;\r\n        await _shipmentService.UpdateShipmentAsync(shipment);\r\n\r\n        //process products with \"Multiple warehouse\" support enabled\r\n        await BookReservedInventoryAsync(shipment, string.Format(await _localizationService.GetResourceAsync(\"Admin.StockQuantityHistory.Messages.Ship\"), shipment.OrderId));\r\n\r\n        //check whether we have more items to ship\r\n        if (await _orderService.HasItemsToAddToShipmentAsync(order) || await _orderService.HasItemsToShipAsync(order))\r\n            order.ShippingStatusId = (int)ShippingStatus.PartiallyShipped;\r\n        else\r\n            order.ShippingStatusId = (int)ShippingStatus.Shipped;\r\n        await _orderService.UpdateOrderAsync(order);\r\n\r\n        //add a note\r","sourceCodeStart":2223,"sourceCodeEnd":2259,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Orders/OrderProcessingService.cs#L2223-L2259","documentation":"Thrown by ShipAsync when the order was placed with the 'pickup in store' shipping option. Such orders have no physical shipment to send - the customer collects from the store - so calling Ship is a domain violation. Uses plain Exception.","triggerScenarios":"Admin UI or API marks a shipment as shipped for an order where order.PickupInStore == true. Typically a workflow mistake: the operator used the wrong action (Ship instead of ReadyForPickup) on a pickup order.","commonSituations":"Operator confusion between Ship and ReadyForPickup actions; custom fulfilment integration calling Ship unconditionally for all shipments; mixed-mode orders handled by a single code path.","solutions":["For pickup orders, call ReadyForPickupAsync instead of ShipAsync.","In the admin/API layer, branch on order.PickupInStore to choose the correct action.","Hide/disable the Ship button in the UI for pickup-in-store orders."],"exampleFix":"// before\nawait _orderProcessingService.ShipAsync(shipment, notify);\n\n// after\nif (order.PickupInStore)\n    await _orderProcessingService.ReadyForPickupAsync(shipment, notify);\nelse\n    await _orderProcessingService.ShipAsync(shipment, notify);","handlingStrategy":"validation","validationCode":"var order = await _orderService.GetOrderByIdAsync(shipment.OrderId);\nif (order is null)\n    return BadRequest(\"Order not found.\");\nif (order.PickupInStore)\n    return BadRequest(\"Cannot ship a pickup-in-store order; use ReadyForPickupAsync.\");\n\nawait _orderProcessingService.ShipAsync(shipment, notifyCustomer);","typeGuard":"async Task<bool> IsShippableAsync(Shipment shipment)\n{\n    var order = await _orderService.GetOrderByIdAsync(shipment.OrderId);\n    return order is not null && !order.PickupInStore;\n}","tryCatchPattern":"try\n{\n    await _orderProcessingService.ShipAsync(shipment, notifyCustomer);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"pickup in store\"))\n{\n    // route to the correct action\n    await _orderProcessingService.ReadyForPickupAsync(shipment, notifyCustomer);\n}","preventionTips":["Branch fulfilment actions on order.PickupInStore: Ship for deliveries, ReadyForPickup for pickups.","In the admin UI, hide the Ship control for pickup-in-store orders.","Document the fulfilment matrix for operators to prevent action misuse."],"tags":["shipment","pickup","domain-violation","fulfilment","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}