JSFiddle - React, Tailwind, and code Playground

HTML

<li class="item">

                <a href="product1.php" title="Sample Product Name" class="product-image">
                                     <span class="sale-item">Sale!</span>
                                    <div class="cat-mouseover"></div>
                    <img src="/images/product1.png" alt="Sample Product Name"></a>
                <h2 class="product-name"><a href="product1.php" title="Sample Product Name">Sample Product Name</a></h2>
    <div class="price-box">
                                
                    <p class="old-price">
                <span class="price-label">For:</span>
                <span class="price" id="old-price-426">
                    &nbsp;199,-                </span>
            </p>

                        <p class="special-price">
                <span class="price-label"></span>
                <span class="price" id="product-price-426">
                    Now&nbsp;139,-                </span>
            </p>
                    
    
        </div>

                                <div class="actions">
                                            <button type="button" title="Buy Now" class="button btn-cart" onclick="setLocation('/checkout/cart/add/uenc/aHR0cDovL3d3dy52aXRhLm5vLw,,/product/426/')"><span><span>Buy</span></span></button>
                                    </div>
            </li>
            
<li class="item">

                <a href="product1.php" title="Sample Product Name" class="product-image">
                                     <span class="sale-item">Sale!</span>
                                    <div class="cat-mouseover"></div>
                    <img src="/images/product1.png" alt="Sample Product Name"></a>
                <h2 class="product-name"><a href="product1.php" title="Sample Product Name">Sample Product Name</a></h2>
    <div class="price-box">
                                
                    <p class="old-price">
                <span...

JavaScript

jQuery(document).ready(function($) {
    
$(".btn-cart").click(function(event) {
    
    
    var href = $('a', this).attr("href");
    var target = $('a', this).attr("target");
    var text = $(this).parents('li').first().find('.product-name').text();  
    
	event.preventDefault();
    
	alert(text);
    
    setTimeout(function() { 
        window.open(href,(!target?"_self":target));
    },300);
});
 
});