Skip to content

Conversation

@Arsh-S
Copy link
Contributor

@Arsh-S Arsh-S commented Oct 25, 2025

This PR refactors the buyer cart logic to improve accuracy and usability. The cart now automatically clears after a successful order and displays total item quantities instead of just unique item counts.

Changes

  • BuyerNavbar.tsx:
    • Simplified logic to compute total quantity directly from the cart array.
    • Updated both desktop and mobile cart badges to display accurate totals with improved styling.
  • ShoppingCart.tsx:
    • Added total item count summary and integrated consistent quantity calculations.
  • CheckoutForm.tsx:
    • Implemented automatic cart clearing after order completion.

Cart Quantity
image

Cart Modal
image

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ Chelsea She
❌ Arsh-S


Chelsea She seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Arsh-S Arsh-S requested a review from stevenyuser October 25, 2025 00:14
@netlify
Copy link

netlify bot commented Oct 25, 2025

Deploy Preview for curaise ready!

Name Link
🔨 Latest commit 1d8b9df
🔍 Latest deploy log https://app.netlify.com/projects/curaise/deploys/68fc1670fb94e100088073cb
😎 Deploy Preview https://deploy-preview-58--curaise.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Collaborator

@stevenyuser stevenyuser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Arsh, nice fix! I just have two small nitpicks, but after those are addressed, the PR should be good to merge!

if ((!cartItems || cartItems.length === 0) && !orderPlaced) {
// If cart is empty and no order was just placed, redirect to the fundraiser page
redirect(`/buyer/fundraiser/${fundraiser.id}`);
return null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this return null; line?

<div className="flex justify-between">
<span className="font-medium">Items</span>
<span className="font-bold">{totalItems}</span>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need items count if it's already shown in the navbar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants