totalQuantity

This commit is contained in:
Kristian Duda 2024-06-28 22:07:06 +02:00
parent 6bbe1668e0
commit b18c017fff
2 changed files with 9 additions and 5 deletions

View File

@ -44,25 +44,26 @@ const reshapeCartItems = (lines: PayloadCart['lines']): CartItem[] => {
};
const reshapeCart = (cart: PayloadCart): Cart => {
const currencyCode = cart.currencyCode!;
return {
id: cart.id,
checkoutUrl: '/api/checkout',
cost: {
totalAmount: {
currencyCode: 'EUR',
currencyCode,
amount: cart.totalAmount?.toString()!
},
totalTaxAmount: {
currencyCode: 'EUR',
amount: '0.0'
currencyCode,
amount: cart.totalTaxAmount?.toString()!
},
subtotalAmount: {
currencyCode: 'EUR',
currencyCode,
amount: '0.0'
}
},
lines: reshapeCartItems(cart.lines),
totalQuantity: 0
totalQuantity: cart.totalQuantity ?? 0
};
};

View File

@ -177,6 +177,9 @@ export interface Product {
export interface Cart {
id: string;
totalAmount?: number | null;
totalTaxAmount?: number | null;
currencyCode?: string | null;
totalQuantity?: number | null;
user?: (string | null) | User;
lines?:
| {