All files / app/shipping isUsingMultiShipping.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 13 14 15 16 17 18  9x   9x   9x 32x 12x     20x   1x     19x    
import { Consignment, LineItemMap } from '@bigcommerce/checkout-sdk';
import { some } from 'lodash';
 
import hasUnassignedLineItems from './hasUnassignedLineItems';
 
export default function isUsingMultiShipping(consignments: Consignment[], lineItems: LineItemMap): boolean {
    if (consignments.length > 1) {
        return true;
    }
 
    if (some(consignments, consignment => consignment.lineItemIds.length) &&
        hasUnassignedLineItems(consignments, lineItems)) {
        return true;
    }
 
    return false;
}