{"record":{"id":"b5859ab297c5a057","repo":"nopSolutions/nopCommerce","slug":"shipping-is-not-required","errorCode":null,"errorMessage":"Shipping is not required","messagePattern":"Shipping is not required","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Controllers/CheckoutController.cs","lineNumber":1695,"sourceCode":"            //validation\r\n            if (_orderSettings.CheckoutDisabled)\r\n                throw new Exception(await _localizationService.GetResourceAsync(\"Checkout.Disabled\"));\r\n\r\n            var customer = await _workContext.GetCurrentCustomerAsync();\r\n            var store = await _storeContext.GetCurrentStoreAsync();\r\n            var cart = await _shoppingCartService.GetShoppingCartAsync(customer, ShoppingCartType.ShoppingCart, store.Id);\r\n\r\n            if (!cart.Any())\r\n                throw new Exception(\"Your cart is empty\");\r\n\r\n            if (!_orderSettings.OnePageCheckoutEnabled)\r\n                throw new Exception(\"One page checkout is disabled\");\r\n\r\n            if (await _customerService.IsGuestAsync(customer) && !_orderSettings.AnonymousCheckoutAllowed)\r\n                throw new Exception(\"Anonymous checkout is not allowed\");\r\n\r\n            if (!await _shoppingCartService.ShoppingCartRequiresShippingAsync(cart))\r\n                throw new Exception(\"Shipping is not required\");\r\n\r\n            //pickup point\r\n            if (_shippingSettings.AllowPickupInStore && !_orderSettings.DisplayPickupInStoreOnShippingMethodPage)\r\n            {\r\n                var pickupInStore = ParsePickupInStore(form);\r\n                if (pickupInStore)\r\n                {\r\n                    var pickupOption = await ParsePickupOptionAsync(cart, form);\r\n                    await SavePickupOptionAsync(pickupOption);\r\n\r\n                    return await OpcLoadStepAfterShippingMethod(cart);\r\n                }\r\n\r\n                //set value indicating that \"pick up in store\" option has not been chosen\r\n                await _genericAttributeService.SaveAttributeAsync<PickupPoint>(customer, NopCustomerDefaults.SelectedPickupPointAttribute, null, store.Id);\r\n            }\r\n\r\n            _ = int.TryParse(form[\"shipping_address_id\"], out var shippingAddressId);\r","sourceCodeStart":1677,"sourceCodeEnd":1713,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Controllers/CheckoutController.cs#L1677-L1713","documentation":"Thrown by OpcSaveShipping when ShoppingCartRequiresShippingAsync(cart) returns false, i.e. none of the cart items are shippable (all digital/downloadable, or IsShipEnabled/FreeShipping flags make shipping unnecessary). Because the shipping step is meaningless, nopCommerce aborts. Hardcoded literal message. It usually means the client navigated to a shipping step that shouldn't exist for this cart.","triggerScenarios":"Cart contains only non-shippable items (downloads, digital goods) yet the client POSTs to OpcSaveShipping. Also when a previously shippable item was replaced by a non-shippable one mid-flow, or the cart was edited so shipping is no longer required.","commonSituations":"Mixed cart reduced to digital-only after a removal; theme always shows the shipping step regardless of cart contents; custom flow skips the shipping-required check; a downloadable product misconfigured as shippable was corrected.","solutions":["Skip the OPC shipping step when the cart requires no shipping (the standard flow does this automatically).","Verify product IsShipEnabled/IsDownload flags reflect intent.","Recompute cart shipping requirement client-side before showing/submitting the step.","Redirect to the next applicable step (payment) instead of calling OpcSaveShipping."],"exampleFix":"// before: always posting shipping\nawait opc.saveShipping(...);\n// after\nconst requiresShipping = await cartRequiresShipping();\nif (!requiresShipping) { gotoPaymentStep(); return; }\nawait opc.saveShipping(...);","handlingStrategy":"validation","validationCode":"// Skip the shipping step entirely when shipping isn't required.\nif (!await _shoppingCartService.ShoppingCartRequiresShippingAsync(cart))\n    return RedirectToRoute(\"CheckoutPaymentMethod\");","typeGuard":null,"tryCatchPattern":"if (data.error && /shipping is not required/i.test(data.message)) {\n  gotoPaymentStep();\n}","preventionTips":["Compute shipping requirement before showing the shipping step.","Re-check the requirement after cart edits.","Don't render a shipping step for digital-only carts."],"tags":["checkout","opc","shipping","cart","validation","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}