Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Neve + Woocomerce link product page

$
0
0

Replies: 0

Greetings
I am trying to chance the hook function to open external affiliate product

Althougth is working when I insert the products with woocomerce shortcut I loose the buy button, but when I insert the products with neve options of products I get the button the link to product won’t get affected, I will like to know if there is a way to customize this redirection.


remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
add_action( 'woocommerce_before_shop_loop_item', 'tsa_woocommerce_link_nofollow', 10 );
function tsa_woocommerce_link_nofollow() {
	global $product;
	if ( $product->is_type('external') ) {
		echo '<a target="_blank" rel="nofollow noopener noreferrer">get_product_url() . '">';
   	}else{
   		echo '<a href="' . get_the_permalink() . '">';
   	}
}
  • This topic was modified 14 minutes ago by lisber.
  • This topic was modified 13 minutes ago by lisber.

Viewing all articles
Browse latest Browse all 59525

Trending Articles