MarketPress products in new window

Hello,

How can we configure that when you click on a product, it opens in a new tab?

For example, if we have an external product with an affiliate link in the store.

Many thanks!

Herby

  • Ashik

    Hi Herby,

    Thank you for your question.

    We're giving you a quick fix as you would like to open your external/affiliate products link in a new tab. Here is the code below

    //Marketplace external type product link open in a new tab
    add_action('wp_footer', 'mp_product_link_newtab', 10);
    function mp_product_link_newtab(){
    	?>
    	<script type="text/javascript">
    		jQuery(document).ready(function(){
    			jQuery('.mp_link-buynow').attr('target', '_blank');
    		});
    	</script>
    	<?php
    }

    Please, place this above code at the very end of function.php file of your theme. You can access your theme function.php file through Dashboard > Appearance > Editor. In case if you don't have access/enabled Editor menu under Dashboard > Appearance you can access then using any FTP client.

    Important: You'll have to put above code to function.php file of your active theme and each theme has a different function.php file. This will work for the external/affiliate product only.

    Feel free to reply here if you've any more questions or concerns. Have a great day ahead.

    Regards,
    Ashik

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.