refactor: use cart.subtotal

This commit is contained in:
Victor Gerbrands 2023-05-04 15:09:38 +02:00
parent 10381c0110
commit 575c3a3d0b
2 changed files with 2 additions and 4 deletions

View File

@ -70,10 +70,7 @@ const reshapeCart = (cart: MedusaCart): Cart => {
const currencyCode = 'EUR'; const currencyCode = 'EUR';
const cost = { const cost = {
subtotalAmount: { subtotalAmount: {
amount: amount: cart?.subtotal?.toString() || '0',
(cart?.tax_total && cart?.total && (cart?.total - cart?.tax_total).toString()) ||
cart?.total?.toString() ||
'0',
currencyCode: currencyCode currencyCode: currencyCode
}, },
totalAmount: { totalAmount: {

View File

@ -338,6 +338,7 @@ export type MedusaCart = {
tax_total?: number; tax_total?: number;
refunded_total?: number; refunded_total?: number;
total?: number; total?: number;
subtotal?: number;
}; };
export type Cart = Partial<MedusaCart> & { export type Cart = Partial<MedusaCart> & {