I need to redirect user to PDP page from PLP page not just on click of image or product name, but on click of whole card.
As per w3 standards I can not write div within anchor otherwise I would have wrapped the card inside anchor tag.
So I used js code to achieve it.
<script type='text/javascript'>
require([
"jquery"
], function($){
$('.product-item-link').click(function() {
window.location.href = "<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
});
});
</script>
As the script is outside of the foreach loop, it does not work as expected.
Is there any other way?