Bug #12038
Updated by Yalavarthi Thriveni 1 day ago
1: Individual Product Shipping (shipsIndividually & maxUnitsPerPackage) What is implemented: In shippingPackage.util.js:L92-124 : javascript const shipsIndividually = s.shipsIndividually !== undefined ? Boolean(s.shipsIndividually) : Boolean(preset.shipsIndividually); const maxPerPkg = Math.max(1, toNumber(s.maxUnitsPerPackage, toNumber(preset.maxUnitsPerPackage, shipsIndividually ? 1 : quantity))); If shipsIndividually: true, maxPerPkg is set to 1. If a customer orders 3 units of a ceramic fountain, the system divides them into 3 separate package boxes in the packages[] array sent to FedEx. The Gap: When FedEx responds with rates for those 3 boxes, shippingSplit.service.js:L470-515 collapses them: javascript const expPkg = expressLive?.packages?.[0] || {}; const stdPkg = standardLive?.packages?.[0] || {}; The customer is charged the combined carrier rate for 3 boxes, but the checkout response and the order.shipments record only register 1 package card. The customer UI and the warehouse packing ticket do not get multi-piece tracking numbers. Individual Product Shipping (shipsIndividually) "When FedEx responds with rates for those 3 boxes, are shipping charges not calculated as the sum of all packages, or not?" packages?" The Answer: How It Works Under the Hood Yes for Live FedEx Rates, but NO for Fallback/Offline Rates. Furthermore, there What is a critical data loss bug in how your database records those 3 boxes. Here is what actually happens step-by-step: 1. Live FedEx API Call (Sum is Calculated Correctly by FedEx) When 3 items have shipsIndividually: true, shippingPackage.util.js:L106-123 creates 3 package objects. sent to FedEx: In fedex.adapter.js:L764-794 shippingPackage.util.js:L92-124 , these 3 boxes are sent in FedEx's requestedPackageLineItems as if a Multi-Piece Shipment (MPS). FedEx rates all product has shipsIndividually: true with a quantity of 3, the engine creates 3 packages together and returns: distinct box entries inside the packages[] array: json "totalNetCharge": "requestedPackageLineItems": [ { "amount": "48.50", "currency": "USD" "sequenceNumber": 1, "weight": { "value": 10, "units": "LB" }, "dimensions": { "length": 14, "width": 12, "height": 8 } }, { "sequenceNumber": 2, "weight": { "value": 10, "units": "LB" }, "dimensions": { "length": 14, "width": 12, "height": 8 } }, { "sequenceNumber": 3, "weight": { "value": 10, "units": "LB" }, "dimensions": { "length": 14, "width": 12, "height": 8 } } (e.g., Box 1 = $16, Box 2 = $17, Box 3 = $15.50 $\rightarrow$ Total = $48.50). ] How FedEx rates it: In fedex.adapter.js:L811-815 fedex.adapter.js:L806-815 , your the adapter extracts shipmentRate.totalNetCharge. Verdict for Live FedEx: The customer In FedEx's official REST API, totalNetCharge is charged the proper multi-piece consolidated sum of all 3 boxes combined (taking into account base freight, dimensional weight per box, and multi-piece discounts). 👉 Yes, when FedEx Live is active, the customer IS charged the combined cost for all 3 boxes. The Critical Gaps in This Flow 2. The Gap A: Offline / Fallback Flaw (Sum is NOT Calculated!) Rate Under-charging (Financial Loss): If FedEx FedEx's API fails, times out, experiences a network timeout or sandbox credentials flake: The temporary outage, the system falls back to buildNationwideCourierOptions . The fallback reads: javascript amount: Number(shippingSettings?.standardShipping?.fallbackRate || 7.99) standardShipping: { fallbackRate: 7.99 } The Bug: It does not multiply by packages.length (3 boxes). It fallback charges a flat $7.99 once, instead of $7.99 $\times$ for the entire order, rather than `$7.99 × 3 boxes = $23.97. Your store loses money $23.97$! You end up paying the carrier fees out-of-pocket. 3. The Package Dimension Drop Bug (Box 2 and Box for 3 are Lost!) Even though FedEx calculates heavy boxes while the rate customer was only charged for 3 boxes, look at 1. Gap B: UI & Order Tracking Metadata Collapse: In shippingSplit.service.js:L258 & L470 shippingSplit.service.js:L470-515 : javascript const pkg expPkg = grpLive?.packages?.[0] expressLive?.packages?.[0] || {}; // ONLY TAKES BOX 0! packageDimensions: { length: Number(pkg.length || 10), width: Number(pkg.width || 8), height: Number(pkg.height || 4), weight: Number(pkg.weight || 1), } The Bug: The checkout order only stores Even though FedEx rated 3 distinct physical boxes, the dimensions of packages[0]. Boxes 2 service pulls packages[0] and 3 disappear from creates only 1 customer-facing shipment card. The customer and the order document! warehouse team are shown: Package Dimensions: 14x12x8, Weight: 10 lb, Quantity: 1 box When your The warehouse packing staff opens the order has no multi-piece shipment (MPS) records to pack and print labels, they only see 1 box, not 3. 3 independent shipping labels. What Does FedEx Consider vs. What Does It Miss? - attached screenshots for this section issues !clipboard-202611061433-73lvm.png! !clipboard-202611061433-8muoo.png!