{"record":{"id":"08723d14f37b7c74","repo":"nopSolutions/nopCommerce","slug":"shipping-address-is-not-provided","errorCode":null,"errorMessage":"Shipping address is not provided","messagePattern":"Shipping address is not provided","errorType":"validation","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/Orders/OrderProcessingService.cs","lineNumber":453,"sourceCode":"                var country = await _countryService.GetCountryByTwoLetterIsoCodeAsync(pickupPoint.CountryCode);\r\n                var state = await _stateProvinceService.GetStateProvinceByAbbreviationAsync(pickupPoint.StateAbbreviation, country?.Id);\r\n\r\n                details.PickupInStore = true;\r\n                details.PickupAddress = new Address\r\n                {\r\n                    Address1 = pickupPoint.Address,\r\n                    City = pickupPoint.City,\r\n                    County = pickupPoint.County,\r\n                    CountryId = country?.Id,\r\n                    StateProvinceId = state?.Id,\r\n                    ZipPostalCode = pickupPoint.ZipPostalCode,\r\n                    CreatedOnUtc = DateTime.UtcNow\r\n                };\r\n            }\r\n            else\r\n            {\r\n                if (details.Customer.ShippingAddressId == null)\r\n                    throw new NopException(\"Shipping address is not provided\");\r\n\r\n                var shippingAddress = await _customerService.GetCustomerShippingAddressAsync(details.Customer);\r\n\r\n                if (!CommonHelper.IsValidEmail(shippingAddress?.Email))\r\n                    throw new NopException(\"Email is not valid\");\r\n\r\n                //clone shipping address\r\n                details.ShippingAddress = _addressService.CloneAddress(shippingAddress);\r\n\r\n                if (await _countryService.GetCountryByAddressAsync(details.ShippingAddress) is Country shippingCountry && !shippingCountry.AllowsShipping)\r\n                    throw new NopException($\"Country '{shippingCountry.Name}' is not allowed for shipping\");\r\n            }\r\n\r\n            var shippingOption = await _genericAttributeService.GetAttributeAsync<ShippingOption>(details.Customer,\r\n                NopCustomerDefaults.SelectedShippingOptionAttribute, processPaymentRequest.StoreId);\r\n            if (shippingOption != null)\r\n            {\r\n                details.ShippingMethodName = shippingOption.Name;\r","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Orders/OrderProcessingService.cs#L435-L471","documentation":"Thrown during shipping address validation when the customer's ShippingAddressId is null (not set) and the order is not a pickup-in-store order. The PlaceOrder flow requires a shipping destination to compute rates and deliver goods, so a missing address is a hard failure.","triggerScenarios":"The customer reached PlaceOrder without completing the shipping address step, the ShippingAddressId was cleared from the customer record between checkout steps, or a programmatic/recurring order request was constructed without setting the address attribute.","commonSituations":"Customer navigated directly to the payment step bypassing the shipping step via a deep link or custom integration. A guest customer's session expired and the address association was lost. A custom checkout flow or API integration that calls PlaceOrder without first persisting the shipping address. Digital-only cart where shipping shouldn't be required but PickupInStore flag wasn't set.","solutions":["Ensure the customer completes the shipping address checkout step before payment is submitted.","In a custom integration, set the shipping address via ICustomerService.AddCustomerAddressAsync and assign Customer.ShippingAddressId before calling PlaceOrder.","For digital/downloadable goods, verify the cart is correctly flagged so shipping is not required.","Add a UI check on the payment page that redirects to the shipping step if no shipping address is set."],"exampleFix":"// before: PlaceOrder called with customer.ShippingAddressId == null\n// after:\nawait _customerService.AddCustomerAddressAsync(customer, address);\ncustomer.ShippingAddressId = address.Id;\nawait _customerService.UpdateCustomerAsync(customer);","handlingStrategy":"validation","validationCode":"// Before PlaceOrder, confirm the customer has a shipping address\nif (!details.PickupInStore && customer.ShippingAddressId == null)\n{\n    _notificationService.ErrorNotification(\"Please provide a shipping address.\");\n    return RedirectToRoute(\"CheckoutShippingAddress\");\n}","typeGuard":"bool HasShippingAddress(Customer c) => c.ShippingAddressId.HasValue;","tryCatchPattern":"try\n{\n    var result = await _orderProcessingService.PlaceOrderAsync(processPaymentRequest);\n}\ncatch (NopException ex) when (ex.Message == \"Shipping address is not provided\")\n{\n    return RedirectToRoute(\"CheckoutShippingAddress\");\n}","preventionTips":["On the payment checkout step, check customer.ShippingAddressId and redirect to the shipping step if null.","For custom integrations, always set ShippingAddressId or mark PickupInStore before calling PlaceOrder.","Implement a checkout progress guard that validates each step's prerequisites before allowing the next.","For guest checkout, ensure the entered address is persisted to the customer record before payment."],"tags":["nopcommerce","shipping-address","checkout","validation","order-processing"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}