All files / app/shipping hasUnassignedLineItems.ts

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12  14x   14x 58x 70x       62x    
import { Consignment, LineItemMap } from '@bigcommerce/checkout-sdk';
import { reduce } from 'lodash';
 
export default function hasUnassignedLineItems(consignments: Consignment[], lineItems: LineItemMap): boolean {
    const totalAssigned = reduce(consignments,
        (total, consignment) => total + consignment.lineItemIds.length,
        0
    );
 
    return totalAssigned < lineItems.physicalItems.filter(item => !item.addedByPromotion).length;
}