Skip to content

Commit

Permalink
🐛 cart normalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
DuvCharles committed May 1, 2024
1 parent d738702 commit 0d22cf8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/sylius/normalizer/cart-normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ export const normalizeCart = (syliusCart: SyliusCart): Cart => {
totalTaxAmount: normalizePrice(syliusCart.taxTotal),
shippingAmount: normalizePrice(syliusCart.shippingTotal)
},
lines: syliusCart.items.map(normalizeCartItem),
totalQuantity: syliusCart.items.reduce((acc, item) => acc + item.quantity, 0)
lines: syliusCart.items ? syliusCart.items.map(normalizeCartItem) : [],
totalQuantity: syliusCart.items
? syliusCart.items.reduce((acc, item) => acc + item.quantity, 0)
: 0
};
};

Expand Down

0 comments on commit 0d22cf8

Please sign in to comment.