{"record":{"id":"430a0121eaf7181b","repo":"nopSolutions/nopCommerce","slug":"no-shipping-info-found-for-paypal-order","errorCode":null,"errorMessage":"No shipping info found for PayPal order","messagePattern":"No shipping info found for PayPal order","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"warning","filePath":"src/Plugins/Nop.Plugin.Payments.PayPalCommerce/Services/PayPalCommerceServiceManager.cs","lineNumber":2933,"sourceCode":"            var nopOrder = await _orderService.GetOrderByIdAsync(shipment?.OrderId ?? 0)\n                ?? throw new NopException(\"Order cannot be loaded\");\n\n            if (!string.Equals(nopOrder.PaymentMethodSystemName, PayPalCommerceDefaults.SystemName, StringComparison.InvariantCultureIgnoreCase))\n                return false;\n\n            var customValues = new CustomValues();\n            customValues.FillByXml(nopOrder.CustomValuesXml);\n            var orderIdKey = await _localizationService.GetResourceAsync(\"Plugins.Payments.PayPalCommerce.Order.Id\");\n            if (!customValues.TryGetValue(orderIdKey, out var orderIdValue))\n                throw new NopException(\"Failed to get PayPal order info\");\n\n            var order = await _httpClient\n                .RequestAsync<GetOrderRequest, GetOrderResponse>(new GetOrderRequest { OrderId = orderIdValue.Value }, settings) as Order;\n            if (order.Status?.ToUpper() != OrderStatusType.COMPLETED.ToString())\n                throw new NopException($\"Unable to assign tracking information to orders in {order.Status} status\");\n\n            if (order.PurchaseUnits?.FirstOrDefault() is not PurchaseUnit unit || unit.Shipping is null)\n                throw new NopException(\"No shipping info found for PayPal order\");\n\n            if (unit.Payments?.Captures?.FirstOrDefault() is not Capture capture ||\n                (capture.Status?.ToUpper() != CaptureStatusType.COMPLETED.ToString() &&\n                capture.Status?.ToUpper() != CaptureStatusType.PARTIALLY_REFUNDED.ToString() &&\n                capture.Status?.ToUpper() != CaptureStatusType.PENDING.ToString()))\n            {\n                throw new NopException($\"Unable to assign tracking information to orders with the payment in {order.Status} status\");\n            }\n\n            var shipmentItems = await _shipmentService.GetShipmentItemsByShipmentIdAsync(shipment.Id);\n            var items = await shipmentItems.SelectAwait(async shipmentItem =>\n            {\n                var orderItem = await _orderService.GetOrderItemByIdAsync(shipmentItem.OrderItemId);\n                var product = await _productService.GetProductByIdAsync(orderItem.ProductId);\n                var sku = await _productService.FormatSkuAsync(product, orderItem.AttributesXml);\n                var url = await _nopUrlHelper.RouteGenericUrlAsync(product, _webHelper.GetCurrentRequestProtocol());\n                var picture = await _pictureService.GetProductPictureAsync(product, orderItem.AttributesXml);\n                var (imageUrl, _) = await _pictureService.GetPictureUrlAsync(picture);","sourceCodeStart":2915,"sourceCodeEnd":2951,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Payments.PayPalCommerce/Services/PayPalCommerceServiceManager.cs#L2915-L2951","documentation":"Thrown inside SetTrackingAsync when the retrieved PayPal order has no purchasable shipping context. The code checks that order.PurchaseUnits has at least one PurchaseUnit and that unit.Shipping is not null. Without shipping info on the PayPal order, there is no recipient address to attach tracking data to.","triggerScenarios":"order.PurchaseUnits is null or empty, or the first PurchaseUnit's Shipping property is null — meaning the PayPal order was created without shipping details (e.g. digital goods, services, or the shipping address was not passed during PayPal order creation).","commonSituations":"The original order contained only digital/downloadable products so no shipping address was sent to PayPal; the PayPal order was created via an API call that omitted the shipping_address field; a custom checkout flow bypassed the standard shipping address collection; order was created via PayPal buttons without shipping preference set.","solutions":["Check whether the order contains shippable items — if not, PayPal tracking sync is unnecessary","If the order should have shipping info, verify the PayPal order creation flow includes the shipping address in the PurchaseUnit","Inspect the PayPal order JSON via the dashboard to confirm whether shipping_address is present","For orders missing shipping info on PayPal's side, the tracking cannot be added — skip sync for these orders"],"exampleFix":"// before\nvar (result, error) = await _serviceManager.SetTrackingAsync(settings, shipment);\n\n// after — check if PayPal order has shipping before calling\nif (paypalOrder.PurchaseUnits?.FirstOrDefault() is not PurchaseUnit unit || unit.Shipping is null)\n{\n    _logger.Information($\"PayPal order {paypalOrderId} has no shipping info; skipping tracking sync\");\n    return;\n}\nvar (result, error) = await _serviceManager.SetTrackingAsync(settings, shipment);","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// HandleFunctionAsync catches internally; skip tracking for orders without shipping\nvar (result, error) = await _serviceManager.SetTrackingAsync(settings, shipment);\nif (!string.IsNullOrEmpty(error) && error.Contains(\"No shipping info\"))\n    _logger.Information($\"PayPal order for shipment {shipment.Id} has no shipping info; skipping\");","preventionTips":["Verify PayPal order creation includes shipping address when the cart has shippable items","Skip tracking sync for digital-only orders to avoid unnecessary API calls","Log which orders lack PayPal shipping info to identify checkout flow gaps","Ensure the PayPal SDK shipping preference is set to GET_FROM_FILE or SET_PROVIDED_ADDRESS during checkout"],"tags":["paypal","shipping-info","shipment-tracking","purchase-unit","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}