fix: fix reshape function for new cart

This commit is contained in:
Victor Gerbrands 2023-05-04 11:43:59 +02:00
parent 99d93093c7
commit 5bcf6cb5eb

View File

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