@@ -137,19 +137,17 @@ const AccountOrderDetail = () => {
137137 // Check if order has OMS data
138138 const isOmsOrder = useMemo ( ( ) => ! ! order ?. omsData , [ order ?. omsData ] )
139139
140- // Check if OMS is returning shipments
141- const hasOmsShipment = useMemo (
142- ( ) => ( order ?. omsData ?. shipments ?. length ?? 0 ) > 0 ,
143- [ order ?. omsData ?. shipments ?. length ]
144- )
140+ const omsShipmentCount = order ?. omsData ?. shipments ?. length ?? 0
141+ const ecomShipmentCount = order ?. shipments ?. length ?? 0
142+
143+ const hasOmsShipment = useMemo ( ( ) => omsShipmentCount > 0 , [ omsShipmentCount ] )
145144
146- // Check if order is multi-shipment order
147145 const isMultiShipmentOrder = useMemo (
148- ( ) => ( order ?. omsData ?. shipments ?. length ?? 0 ) > 1 || ( order ?. shipments ?. length ?? 0 ) > 1 ,
149- [ order ?. omsData ?. shipments ?. length , order ?. shipments ?. length ]
146+ ( ) => omsShipmentCount > 1 || ecomShipmentCount > 1 ,
147+ [ omsShipmentCount , ecomShipmentCount ]
150148 )
151149
152- const showShipmentsFromOmsOnly = isOmsOrder && hasOmsShipment && isMultiShipmentOrder
150+ const showMultiShipmentsFromOmsOnly = isOmsOrder && hasOmsShipment && isMultiShipmentOrder
153151
154152 const { pickupShipments, deliveryShipments} = useMemo ( ( ) => {
155153 return storeLocatorEnabled
@@ -404,7 +402,7 @@ const AccountOrderDetail = () => {
404402 )
405403 } ) }
406404 { /* Any type of Non-OMS or any type of single shipment order: show DeliveryMethods and Shipments info*/ }
407- { ! showShipmentsFromOmsOnly &&
405+ { ! showMultiShipmentsFromOmsOnly &&
408406 deliveryShipments . map ( ( shipment , index ) => {
409407 const omsShipment = isOmsOrder
410408 ? order . omsData . shipments ?. [ index ]
@@ -465,15 +463,15 @@ const AccountOrderDetail = () => {
465463 } ) }
466464
467465 { /* Any OMS multi-shipment: Only show OMS Shipments info;*/ }
468- { showShipmentsFromOmsOnly &&
466+ { showMultiShipmentsFromOmsOnly &&
469467 order ?. omsData ?. shipments ?. map ( ( shipment , index ) => (
470468 < React . Fragment key = { `oms-shipment-${ index } ` } >
471469 { renderShippingMethod (
472470 shipment . provider ,
473471 shipment . status ,
474472 shipment . trackingNumber ,
475473 shipment . trackingUrl ,
476- order ?. omsData ?. shipments ?. length ?? 0 ,
474+ omsShipmentCount ,
477475 index
478476 ) }
479477 </ React . Fragment >
0 commit comments