Skip to content

Conversation

@Prabhjot-frappe
Copy link

This PR addresses a small but important issue regarding the behavior of the "Add to Cart" and "Go to Cart" buttons.

Problem: Both buttons shared the same class and properties, making it difficult to differentiate between them and apply specific functions. Specifically, when the "Go to Cart" button was clicked, the logic for the "Add to Cart" button was still being triggered, causing the cart-checking logic to execute incorrectly.

Solution: I have updated the button logic to distinguish between the "Add to Cart" and "Go to Cart" buttons by modifying the class names and event handlers.

Functionality:

When the "Add to Cart" button is clicked, the function checks if the cart already contains an item. If not, it adds the product to the cart.

When the "Go to Cart" button is clicked, it triggers the Go to Cart function, without interfering with the "Add to Cart" logic.

This allows for correct behavior based on which button is pressed.

Technical Details:

I updated the classes for the "Add to Cart" and "Go to Cart" buttons to make them distinct.

The logic ensures that only the appropriate function is triggered when each button is clicked, avoiding unwanted cart-checking when navigating to the cart.

Impact:

This change resolves the issue of the cart-checking logic being incorrectly triggered when navigating to the cart.

Users can now smoothly add items to the cart and go to the cart without interference between the two actions.

@rmehta

Screencast.from.02-05-25.04.33.19.PM.IST.webm

@Prabhjot-frappe Prabhjot-frappe changed the title feat(cart): differentiate 'Add to Cart' and 'Go to Cart' buttons by using separate class names hot-fix: differentiate 'Add to Cart' and 'Go to Cart' buttons by using separate class names May 2, 2025
@Prabhjot-frappe
Copy link
Author

@sapna-kcs sapna sharma

@Prabhjot-frappe
Copy link
Author

@rmehta sir I’ve created this PR and wanted to bring it to your attention for review.

@Prabhjot-frappe
Copy link
Author

@rmehta sir plzz give your review and feedback

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.

1 participant