Files
webshop/shop/lib/checkout-split.ts

18 lines
554 B
TypeScript

export interface CartItem {
id?: string;
billingInterval?: 'one_time' | 'monthly';
billingType?: 'purchase' | 'subscription';
selections: any;
moduleQuantities?: Record<string, number>;
}
export function splitCart(items: CartItem[]) {
const purchaseItems = items.filter(
item => item.billingInterval === 'one_time' || item.billingType === 'purchase'
);
const subscriptionItems = items.filter(
item => item.billingInterval === 'monthly' || item.billingType === 'subscription'
);
return { purchaseItems, subscriptionItems };
}