{"record":{"id":"6c169fe4d8628ef1","repo":"nopSolutions/nopCommerce","slug":"customer-shipping-address-not-set","errorCode":null,"errorMessage":"Customer shipping address not set","messagePattern":"Customer shipping address not set","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Plugins/Nop.Plugin.Payments.PayPalCommerce/Services/PayPalCommerceServiceManager.cs","lineNumber":340,"sourceCode":"        //get shipping details\n        details.ShippingOption = await _genericAttributeService\n            .GetAttributeAsync<NopShippingOption>(customer, NopCustomerDefaults.SelectedShippingOptionAttribute, store.Id);\n        details.PickupPoint = await _genericAttributeService\n            .GetAttributeAsync<PickupPoint>(customer, NopCustomerDefaults.SelectedPickupPointAttribute, store.Id);\n        details.IsPickup = _shippingSettings.AllowPickupInStore && details.PickupPoint is not null;\n        details.ShippingAddress = details.IsPickup ? new NopAddress\n        {\n            Address1 = details.PickupPoint.Address,\n            City = details.PickupPoint.City,\n            County = details.PickupPoint.County,\n            CountryId = (await _countryService.GetCountryByTwoLetterIsoCodeAsync(details.PickupPoint.CountryCode))?.Id,\n            StateProvinceId = (await _stateProvinceService.GetStateProvinceByAbbreviationAsync(details.PickupPoint.StateAbbreviation,\n                (await _countryService.GetCountryByTwoLetterIsoCodeAsync(details.PickupPoint.CountryCode))?.Id))?.Id,\n            ZipPostalCode = details.PickupPoint.ZipPostalCode,\n            CreatedOnUtc = DateTime.UtcNow\n        } : await _addressService.GetAddressByIdAsync(customer.ShippingAddressId ?? 0);\n        if (placement == ButtonPlacement.PaymentMethod && shippingIsRequired && details.ShippingAddress is null)\n            throw new NopException(\"Customer shipping address not set\");\n\n        return details;\n    }\n\n    /// <summary>\n    /// Prepare order context\n    /// </summary>\n    /// <param name=\"settings\">Plugin settings</param>\n    /// <param name=\"details\">Shopping cart details</param>\n    /// <param name=\"orderGuid\">Order internal id</param>\n    /// <param name=\"isApplePay\">Apple Pay payment</param>\n    /// <returns>Experience context</returns>\n    private ExperienceContext PrepareOrderContext(PayPalCommerceSettings settings, CartDetails details, string orderGuid, bool isApplePay = false)\n    {\n        var protocol = _webHelper.GetCurrentRequestProtocol();\n\n        var shippingPreference = ShippingPreferenceType.NO_SHIPPING.ToString().ToUpper();\n        if (details.ShippingIsRequired)","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Payments.PayPalCommerce/Services/PayPalCommerceServiceManager.cs#L322-L358","documentation":"Thrown during cart details preparation when shipping is required, the customer has no shipping address, and the placement is the payment method page. The plugin resolves the shipping address from customer.ShippingAddressId (or builds one from a pickup point); if none exists and shipping is mandatory, this fires.","triggerScenarios":"PrepareCartDetailsAsync is called with placement == ButtonPlacement.PaymentMethod, shippingIsRequired is true, the order is not a pickup, and customer.ShippingAddressId is null or resolves to a deleted/nonexistent address.","commonSituations":"Customer reached the payment step without selecting a shipping address; address record was deleted between steps; checkout flow customization that skips the shipping address step; cart contains shippable items but the shipping address form was never completed.","solutions":["Ensure the customer selects a shipping address before reaching the payment method page when the cart contains shippable items","Check that customer.ShippingAddressId has a value and the address record exists before invoking the payment flow","Redirect to the shipping address step if the address is missing and the cart requires shipping","Verify the cart's shipping requirement status is accurate (check product IsShipEnabled flags)"],"exampleFix":"// before\nvar details = await manager.PrepareCartDetailsAsync(placement);\n\n// after\nvar requiresShipping = await _shoppingCartService.ShoppingCartRequiresShippingAsync(cart);\nif (placement == ButtonPlacement.PaymentMethod && requiresShipping &&\n    (!customer.ShippingAddressId.HasValue ||\n     await _addressService.GetAddressByIdAsync(customer.ShippingAddressId.Value) is null))\n    return RedirectToRoute(\"CheckoutShippingAddress\");\nvar details = await manager.PrepareCartDetailsAsync(placement);","handlingStrategy":"validation","validationCode":"// Validate shipping address exists when shipping is required\nif (placement == ButtonPlacement.PaymentMethod)\n{\n    var requiresShipping = await _shoppingCartService.ShoppingCartRequiresShippingAsync(cart);\n    if (requiresShipping)\n    {\n        var shippingAddressId = customer.ShippingAddressId;\n        if (!shippingAddressId.HasValue || shippingAddressId.Value == 0)\n            return Error(\"Shipping address required\");\n        var addr = await _addressService.GetAddressByIdAsync(shippingAddressId.Value);\n        if (addr is null)\n            return Error(\"Shipping address record not found\");\n    }\n}","typeGuard":null,"tryCatchPattern":"var (result, error) = await manager.PrepareCartDetailsAsync(placement);\nif (!string.IsNullOrEmpty(error))\n{\n    if (error == \"Customer shipping address not set\")\n        return RedirectToRoute(\"CheckoutShippingAddress\");\n}","preventionTips":["Ensure the shipping address step is completed before the payment method step","Check ShoppingCartRequiresShippingAsync to know whether shipping address is mandatory","Validate shipping address ID resolves to a non-null record before payment preparation"],"tags":["checkout","shipping-address","paypal-commerce","nopcommerce","customer-data"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}