All files / app/shipping itemsRequireShipping.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 19 20    9x 62x 4x     58x 52x     6x 2x     4x     9x  
import { Cart, StoreConfig } from '@bigcommerce/checkout-sdk';
 
const itemsRequireShipping = (cart?: Cart, config?: StoreConfig) => {
    if (!cart) {
        return false;
    }
 
    if (cart.lineItems.physicalItems.some(lineItem => lineItem.isShippingRequired)) {
        return true;
    }
 
    if (config && config.checkoutSettings.features['CHECKOUT-4936.enable_custom_item_shipping'] && cart.lineItems.customItems) {
        return cart.lineItems.customItems.length > 0;
    }
 
    return false;
};
 
export default itemsRequireShipping;