• Resolved adityajejurkar

    (@adityajejurkar)


    Hello I’m developing a new site in my product listing page i want to open each and every product in a new tab. I’d entered one code :

    jQuery(document).ready(function($){
    $(‘.woocommerce.archive .products .product’).each(function(){
    $(this).find(‘a’).attr(‘target’, ‘_blank’ );
    });
    });

    But this works only for 1st page of the pagination. It does not work on 2nd, other pagination and also does not work when I select some category.

Viewing 1 replies (of 1 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the following places for more development-oriented questions:

    1. WooCommerce Slack Community: https://woocommerce.com/community-slack/
    2. Advanced WooCommerce group on Facebook: https://www.facebook.com/groups/advanced.woocommerce/

    Looking at the code in question though, you’ll want to check the following:

    • That the class selectors “‘.woocommerce.archive .products .product” are present on page 2 and on category pages
    • That page 2+ is not loaded dynamically via AJAX – your jQuery will only work on the initial product load; For AJAX loaded products, you’ll want to add a listener.
Viewing 1 replies (of 1 total)
  • The topic ‘Woocommerce product listing open product new tab’ is closed to new replies.