Skip to content

update cart button behavior - #459

Merged
Nsanjayboruds merged 5 commits into
Nsanjayboruds:mainfrom
SharayuShelke2006:addtocartbuttonstates
Jul 13, 2026
Merged

update cart button behavior#459
Nsanjayboruds merged 5 commits into
Nsanjayboruds:mainfrom
SharayuShelke2006:addtocartbuttonstates

Conversation

@SharayuShelke2006

Copy link
Copy Markdown
Contributor

Pull Request

Summary

Improved the product page user experience by temporarily changing the "Add to Cart" button to "Go to Cart" after a successful add-to-cart action, providing users with quick access to their cart.

Description

This PR introduces a temporary UI state for the primary action button on the Product Detail page.

What changed

  • Added a local component state to track a successful add-to-cart action.
  • Updated the button label from "Add to Cart" to "Go to Cart" immediately after an item is added.
  • Clicking "Go to Cart" redirects the user to the Cart page.
  • The button automatically resets to "Add to Cart" when the page is refreshed or the product page is revisited.

Why this approach?

Instead of permanently changing the button based on the product's presence in the cart, this implementation intentionally uses local component state.

This ensures users receive immediate feedback after adding an item while avoiding unintended behavior in cases where they may want to:

  • Add the same product in a different size or variant.
  • Increase the quantity of the same product.
  • Continue shopping without the primary action permanently changing.

This approach improves the shopping experience without modifying the existing cart logic or global state management.

Related Issue

Fixes #458

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • UI/UX improvement
  • Refactoring

Checklist

  • Code follows project guidelines
  • Tested locally
  • No console errors
  • Documentation updated if required
addtocartbutton.1.mp4

@SharayuShelke2006

Copy link
Copy Markdown
Contributor Author

Hi! @Nsanjayboruds I noticed the GitHub Actions workflow is failing due to ESLint errors in backend/index.js:

  • globalIpLimiter is defined but never used.
  • notificationRouter, botRoute, fileURLToPath, path, fs, and express are reported as undefined.

My changes in this PR are limited to the product page UI (temporarily changing the "Add to Cart" button to "Go to Cart" after a successful add-to-cart action), and I didn't modify backend/index.js.

Could you please confirm whether these are existing issues on the base branch or if there's something I need to update in my branch? I'd be happy to make any changes if required. Thanks!

@Nsanjayboruds

Copy link
Copy Markdown
Owner

@SharayuShelke2006 fix the backed lint

@Nsanjayboruds
Nsanjayboruds merged commit 5db9fcc into Nsanjayboruds:main Jul 13, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT]: Update Add to Cart Button to "Go to Cart" After Successful Addition

2 participants