mirror of
https://github.com/vercel/commerce.git
synced 2025-05-12 12:47:50 +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 reshapeCart = (cart: PayloadCart): Cart => {
|
||||||
|
const currencyCode = cart.currencyCode!;
|
||||||
return {
|
return {
|
||||||
id: cart.id,
|
id: cart.id,
|
||||||
checkoutUrl: '/api/checkout',
|
checkoutUrl: '/api/checkout',
|
||||||
cost: {
|
cost: {
|
||||||
totalAmount: {
|
totalAmount: {
|
||||||
currencyCode: 'EUR',
|
currencyCode,
|
||||||
amount: cart.totalAmount?.toString()!
|
amount: cart.totalAmount?.toString()!
|
||||||
},
|
},
|
||||||
totalTaxAmount: {
|
totalTaxAmount: {
|
||||||
currencyCode: 'EUR',
|
currencyCode,
|
||||||
amount: '0.0'
|
amount: cart.totalTaxAmount?.toString()!
|
||||||
},
|
},
|
||||||
subtotalAmount: {
|
subtotalAmount: {
|
||||||
currencyCode: 'EUR',
|
currencyCode,
|
||||||
amount: '0.0'
|
amount: '0.0'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
lines: reshapeCartItems(cart.lines),
|
lines: reshapeCartItems(cart.lines),
|
||||||
totalQuantity: 0
|
totalQuantity: cart.totalQuantity ?? 0
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -177,6 +177,9 @@ export interface Product {
|
|||||||
export interface Cart {
|
export interface Cart {
|
||||||
id: string;
|
id: string;
|
||||||
totalAmount?: number | null;
|
totalAmount?: number | null;
|
||||||
|
totalTaxAmount?: number | null;
|
||||||
|
currencyCode?: string | null;
|
||||||
|
totalQuantity?: number | null;
|
||||||
user?: (string | null) | User;
|
user?: (string | null) | User;
|
||||||
lines?:
|
lines?:
|
||||||
| {
|
| {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user