{"record":{"id":"75bd37a3199adc50","repo":"nopSolutions/nopCommerce","slug":"selected-shipping-method-can-t-be-parsed","errorCode":null,"errorMessage":"Selected shipping method can't be parsed","messagePattern":"Selected shipping method can't be parsed","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Controllers/CheckoutController.cs","lineNumber":1834,"sourceCode":"            //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            //parse selected method \r\n            if (string.IsNullOrEmpty(shippingoption))\r\n                throw new Exception(\"Selected shipping method can't be parsed\");\r\n            var splittedOption = shippingoption.Split(_separator, StringSplitOptions.RemoveEmptyEntries);\r\n            if (splittedOption.Length != 2)\r\n                throw new Exception(\"Selected shipping method can't be parsed\");\r\n            var selectedName = splittedOption[0];\r\n            var shippingRateComputationMethodSystemName = splittedOption[1];\r\n\r\n            //find it\r\n            //performance optimization. try cache first\r\n            var shippingOptions = await _genericAttributeService.GetAttributeAsync<List<ShippingOption>>(customer,\r\n                NopCustomerDefaults.OfferedShippingOptionsAttribute, store.Id);\r\n            if (shippingOptions == null || !shippingOptions.Any())\r\n            {\r\n                //not found? let's load them using shipping service\r\n                shippingOptions = (await _shippingService.GetShippingOptionsAsync(cart, await _customerService.GetCustomerShippingAddressAsync(customer),\r\n                    customer, shippingRateComputationMethodSystemName, store.Id)).ShippingOptions.ToList();\r\n            }\r\n            else\r\n            {\r","sourceCodeStart":1816,"sourceCodeEnd":1852,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Controllers/CheckoutController.cs#L1816-L1852","documentation":"Thrown by OpcSaveShippingMethod at line 1834 when the 'shippingoption' parameter is null or empty. nopCommerce expects a single string 'Name___ShippingRateComputationMethodSystemName' (split on the three-underscore _separator) and refuses empty input. Hardcoded literal message. The client failed to send any selected shipping method.","triggerScenarios":"POST to OpcSaveShippingMethod with shippingoption missing, null, or whitespace. Form/radio not bound, JS sent an empty value, or the user submitted without selecting a method.","commonSituations":"Shipping-method radio rendered without a value/unchecked on submit; AJAX payload field name mismatch (e.g. shippingOption vs shippingoption); custom theme forgetting to include the selected option; no shipping options available so none selected.","solutions":["Ensure the selected radio/hidden input posts a non-empty 'shippingoption'.","Disable the submit button until a shipping method is selected.","Verify the AJAX field name is exactly 'shippingoption' (case-sensitive).","Confirm shipping rate computation methods returned options so one can be chosen."],"exampleFix":"// before: empty payload\n$.post('OpcSaveShippingMethod', { shippingoption: '' });\n// after\nconst sel = document.querySelector('input[name=shippingoption]:checked');\nif (!sel) { showError('Select a shipping method'); return; }\n$.post('OpcSaveShippingMethod', { shippingoption: sel.value }); // e.g. 'Ground___Shipping.FixedByWeightByTotal'","handlingStrategy":"validation","validationCode":"// Require a non-empty selected option before submitting.\nconst sel = document.querySelector('input[name=shippingoption]:checked');\nif (!sel || !sel.value) { showError('Select a shipping method'); return; }","typeGuard":"function isValidShippingOptionInput(v /*: unknown*/) /*: v is string */ {\n  return typeof v === 'string' && v.trim().length > 0 && v.split('___').filter(Boolean).length === 2;\n}","tryCatchPattern":"if (data.error && /shipping method can't be parsed/i.test(data.message)) {\n  highlightShippingOptions();\n}","preventionTips":["Disable submit until a shipping method is selected.","Use the exact field name 'shippingoption'.","Render shipping radios with the 'Name___SystemName' value."],"tags":["checkout","opc","shipping","parsing","validation","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}