{"record":{"id":"ffb7b88e0cb5a621","repo":"nopSolutions/nopCommerce","slug":"checkout-disabled","errorCode":null,"errorMessage":"Checkout.Disabled","messagePattern":"Checkout\\.Disabled","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Controllers/CheckoutController.cs","lineNumber":1525,"sourceCode":"\r\n        if (!_orderSettings.OnePageCheckoutEnabled)\r\n            return RedirectToRoute(NopRouteNames.Standard.CHECKOUT);\r\n\r\n        if (await _customerService.IsGuestAsync(customer) && !_orderSettings.AnonymousCheckoutAllowed)\r\n            return Challenge();\r\n\r\n        var model = await _checkoutModelFactory.PrepareOnePageCheckoutModelAsync(cart);\r\n        return View(model);\r\n    }\r\n\r\n    [HttpPost]\r\n    public virtual async Task<IActionResult> OpcSaveBilling(CheckoutBillingAddressModel model, IFormCollection form)\r\n    {\r\n        try\r\n        {\r\n            //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            _ = int.TryParse(form[\"billing_address_id\"], out var billingAddressId);\r\n\r\n            if (billingAddressId > 0)\r\n            {\r","sourceCodeStart":1507,"sourceCodeEnd":1543,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Controllers/CheckoutController.cs#L1507-L1543","documentation":"Thrown at the start of OpcSaveBilling (one-page checkout billing save) when _orderSettings.CheckoutDisabled is true. The message is the localized 'Checkout.Disabled' resource, i.e., the store administrator has turned off checkout globally. The exception is caught downstream and surfaced as JSON. It is a configuration gate, not a runtime fault: checkout is intentionally closed.","triggerScenarios":"OrderSettings.CheckoutDisabled = true (admin toggled 'Disable checkout' in configuration settings), and a customer's OPC billing save request reaches OpcSaveBilling. The POST is rejected with the disabled-checkout message.","commonSituations":"Store in maintenance mode or pre-launch with checkout disabled; admin disabled checkout during an incident but the storefront still received OPC AJAX calls; misconfiguration where CheckoutDisabled was set and forgotten; cached client still attempting checkout after the toggle.","solutions":["Re-enable checkout in OrderSettings (set CheckoutDisabled = false) when the store is ready.","If intentionally disabled, ensure the storefront hides/disables the checkout entry so these POSTs do not occur.","Clear storefront cache and reload after toggling so the disabled state is consistent.","Return a clear localized 'checkout is currently unavailable' page instead of a thrown exception on the AJAX path."],"exampleFix":"// before\nif (_orderSettings.CheckoutDisabled)\n    throw new Exception(await _localizationService.GetResourceAsync(\"Checkout.Disabled\"));\n// after (redirect for the AJAX path)\nif (_orderSettings.CheckoutDisabled)\n    return Json(new { redirect = Url.RouteUrl(NopRouteNames.General.CART) });","handlingStrategy":"validation","validationCode":"// Gate the OPC path on configuration without throwing.\nif (_orderSettings.CheckoutDisabled)\n    return Json(new { redirect = Url.RouteUrl(NopRouteNames.General.CART) });","typeGuard":null,"tryCatchPattern":"// Wrapped downstream; returns JSON error. Prefer the redirect pattern above.","preventionTips":["Re-enable checkout (CheckoutDisabled = false) when the store is live.","Hide/disable the checkout entry on the storefront while disabled so OPC calls do not fire.","Clear cache and reload the storefront after toggling the setting."],"tags":["nopcommerce","checkout","configuration","disabled","settings","localization"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}