Woocommerce open external product in new tab
Below is the code to open the woocommerce external product link in a new tab:
function external_product_open_in_new_tab($args, $product)
{
if( $product->is_type('external') ) {
$args['attributes']['target'] = '_blank';
}
return $args;
}
add_filter( 'woocommerce_loop_add_to_cart_args', 'external_product_open_in_new_tab', 10, 2 );