feat(MED-100): show cart line item quantities total instead of items total count

This commit is contained in:
2025-08-28 14:20:27 +03:00
parent b931035c3b
commit b3505c1627
3 changed files with 7 additions and 6 deletions

View File

@@ -31,8 +31,8 @@ export async function HomeMenuNavigation(props: {
})
: 0;
const cartItemsCount = props.cart?.items?.length ?? 0;
const hasCartItems = cartItemsCount > 0;
const cartQuantityTotal = props.cart?.items?.reduce((acc, item) => acc + item.quantity, 0) ?? 0;
const hasCartItems = cartQuantityTotal > 0;
return (
<div className={'flex w-full flex-1 items-center justify-between gap-3'}>
@@ -64,7 +64,7 @@ export async function HomeMenuNavigation(props: {
<ShoppingCart className="stroke-[1.5px]" />
<Trans
i18nKey="common:shoppingCartCount"
values={{ count: cartItemsCount }}
values={{ count: cartQuantityTotal }}
/>
</Button>
</Link>

View File

@@ -51,8 +51,8 @@ export function HomeMobileNavigation(props: {
}
});
const cartItemsCount = props.cart?.items?.length ?? 0;
const hasCartItems = cartItemsCount > 0;
const cartQuantityTotal = props.cart?.items?.reduce((acc, item) => acc + item.quantity, 0) ?? 0;
const hasCartItems = cartQuantityTotal > 0;
return (
<DropdownMenu>
@@ -83,7 +83,7 @@ export function HomeMobileNavigation(props: {
path="/home/cart"
label="common:shoppingCartCount"
Icon={<ShoppingCart className="stroke-[1.5px]" />}
labelOptions={{ count: cartItemsCount }}
labelOptions={{ count: cartQuantityTotal }}
/>
</DropdownMenuGroup>
<DropdownMenuSeparator />

View File

@@ -3,6 +3,7 @@ RETURNS boolean AS $$
SELECT EXISTS (
SELECT 1 FROM medreport.medipost_actions
WHERE medusa_order_id = $1
AND action = 'send_order_to_medipost'
AND has_error = true
);
$$ LANGUAGE sql STABLE;