Hello
I use this code to send directly to amazon and add the nofollow rel.
/* Amazon directo*/
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
add_action( 'woocommerce_before_shop_loop_item', 'woocommerce_link_nofollow_to_amazon', 10 );
function woocommerce_link_nofollow_to_amazon() {
global $product;
if ( $product->is_type('external') ) {
echo '<a target="_blank" rel="nofollow" class="woocommerce-LoopProduct-link" href="' . $product->get_product_url() . '">';
}else{
echo '<a href="' . get_the_permalink() . '" class="woocommerce-LoopProduct-link">';
}
}
Is any way to also add rel = “sponsored” in this code?
Thanks greetings
Hey Ganubis,
should be:
echo '<a target="_blank" rel="nofollow sponsored" class="woocommerce-LoopProduct-link" href="' . $product->get_product_url() . '">';
Best regards,
Victoria
work, thanks
Hi Ganubis,
Great :)
We are closing the thread.
If you need further assistance please let us know in a new one.
Best regards,
Victoria