skip to Main Content

i want my product in new tab for user. if any one click on product the product display in new tab.

it’s a woocommerce website which have multiple product but i want the product should be display in new tab.

2

Answers


  1. you can do this using JQuery, like

    $('a').attr('target' '_blank');
    

    This will select all the elements with a tag but you need to target the element according to your own DOM

    Login or Signup to reply.
  2. You can add target using jquery.

    <script>
    jQuery(document).ready(function(){
        jQuery('li.product a.woocommerce-loop-product__link').attr('target' '_blank');
    });
    </script>
    

    Above script will add "target=_blank" to all woocommerce product.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search