• Resolved naastech2019

    (@naastech2019)


    I need help to get some codes that help me out to open the product page on a new tab. When I click on the product slider image, the product page will be open but on the same page. I use the below mention code but it’s only working on the shop page, not on the product slider image.

    remove_action( 'woocommerce_before_shop_loop_item','woocommerce_template_loop_product_link_open', 10 );
    add_action ( 'woocommerce_before_shop_loop_item', 'ami_function_open_new_tab', 10 );
    function ami_function_open_new_tab() {
    echo '<a target="_blank" href="' . get_the_permalink() . '" class="woocommerce-LoopProduct-link">';
    }
Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Support Bayejid Ahmed

    (@bayejid00)

    Hi @naastech2019,

    The Product Slider for WooCommerce plugin does not hook ‘woocommerce_before_shop_loop_item’ in the slider. So, your mentioned way will not work.

    The option of opening in a new tab is not available in the lite version. However, you can do it with the following code by placing it in the current theme’s functions.php file at the bottom.

    add_action( 'wp_footer', function () { ?>
    <script>
        (function($){
            $(document).on('ready', function(){
                $('.wpsf-product a:not("button")').each(function(){
                    $(this).attr('target', '_blank');
                });
            });
        })(jQuery);
    </script>
    <?php },99 );

    Let us know if it works or not.

    Thread Starter naastech2019

    (@naastech2019)

    Unable to save php

    Your PHP code changes were rolled back due to an error on line 220 of file wp-content/themes/hello-elementor/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘&’

    Plugin Support Bayejid Ahmed

    (@bayejid00)

    Hi @naastech2019,

    You should use like the screenshot .

    If you can not add, create a support ticket for further assistance.

    • This reply was modified 2 years, 11 months ago by Bayejid Ahmed.
    Thread Starter naastech2019

    (@naastech2019)

    above share codes are not working.

    Plugin Support Bayejid Ahmed

    (@bayejid00)

    Hi @naastech2019,

    Sorry to hear that the above code didn’t work for you. We have tested the code on multiple testing sites and it’s working perfectly. We need to review your website and the product slider section. Could you please open a support ticket here sharing the page link?

    Your co-operation would be appreciated. Thanks.

    Thread Starter naastech2019

    (@naastech2019)

    site is elfclick.com

    Plugin Support Bayejid Ahmed

    (@bayejid00)

    Hi @naastech2019,

    Thank you for sharing the page link. But the site is locked https://prnt.sc/23ol55f

    I can not see the page to review.

    Thread Starter naastech2019

    (@naastech2019)

    Sorry. Please check now.

    Plugin Support Bayejid Ahmed

    (@bayejid00)

    Hi @naastech2019,

    I have reviewed the website, and the slider section is not from the Product Slider for WooCommerce plugin. And for that reason, the snippet code is not working.

    Make sure that you are using the Product Slider for WooCommerce plugin going to plguins page like this screenshot https://prnt.sc/23onk88

    Thread Starter naastech2019

    (@naastech2019)

    Can you please guide me php code which enable it. I am using Woolenter plugin for slider.

    Plugin Support Bayejid Ahmed

    (@bayejid00)

    Hi @naastech2019,

    The HTML structure of the slider of Woolentor plugin is little different. The above PHP code will not work. Please ask for support to the Woolentor plugin support forum.

    Thread Starter naastech2019

    (@naastech2019)

    I use below mention code on the oceanwp theme but it’s not working on the shop page. can you please check and guide me?

    add_action( 'wp_footer', function () { ?>
    <script>
        (function($){
            $(document).on('ready', function(){
                $('.wpsf-product a:not("button")').each(function(){
                    $(this).attr('target', '_blank');
                });
            });
        })(jQuery);
    </script>
    <?php },99 );
    Plugin Support Bayejid Ahmed

    (@bayejid00)

    Hi @naastech2019,

    The above code will work only for the Product Slider section.

    Have you used the Product Slider on the shop page?

    Regards,

    Thread Starter naastech2019

    (@naastech2019)

    no. I just want to use code on product grid shown on shop page or even on landing page or category pages through elementor.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘unable to open product page on new tab while i click on product slider image’ is closed to new replies.