Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1248980

    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

    #1249121

    Hey Ganubis,

    Yes, this line
    Image 2020-09-28 at 19.54.05.png

    should be:

    
     echo '<a target="_blank" rel="nofollow sponsored" class="woocommerce-LoopProduct-link" href="' . $product->get_product_url() . '">';
    

    Best regards,
    Victoria

    #1249135

    work, thanks

    #1249157

    Hi Ganubis,

    Great :)

    We are closing the thread.

    If you need further assistance please let us know in a new one.

    Best regards,
    Victoria

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Add sponsored rel to cart buttons’ is closed to new replies.