mirror of
https://github.com/vercel/commerce.git
synced 2025-05-11 12:17:51 +00:00
totalQuantity
This commit is contained in:
parent
6bbe1668e0
commit
b18c017fff
@ -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
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -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?:
|
||||
| {
|
||||
|
Loading…
x
Reference in New Issue
Block a user