I am building a retail website. In my product list page, I'm listing each product as a block (3 blocks per row). Inside each block, I want to show details like name, price, sale price, etc. I also want an "Add to Cart" button inside each block where if the user clicks on it, I will use a JS function to add the product to the cart. I want the entire block to be clickable and take the user to the product detail page when clicked. I have an anchor tag around the entire block.
My problem is when a user clicks on the Add to Cart button, it adds the item to the cart via JS, but then the anchor tag fires and takes the user to the details page. What's the best way to handle this?
I can move the Add to Cart button out of the block but I'd rather not as there is a border around the block.