• Hi,

    Is there a way to disable the wishlist icon from the related products? I get a notification from SEOPress plugin that i have too many nofollow links and it’s mostly coming from the wishlist.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Do you plan to remove Add to Wishlist from any loop or just from related?

    In the first case I suggest you to disable “Show Add to Wishlist in loop” option under WP Dashboard -> YITH -> Wishlist -> Add to Wishlist Options -> Loop Settings

    In second case you’ll need a custom code in order to add Add to Wishlist button only on locations where you want it to appear

    Thread Starter alexio

    (@alexio)

    I was looking to remove it only from related products.
    Since there is no setting for it, i will try to figure something out.
    Thank you for the quick reply.

    Plugin Author YITHEMES

    (@yithemes)

    Hi again

    I recently answered another topic with something that maybe could help you with your task
    Please, have a look at my answer here

    Using the filter that we’re going to add in next plugin version, and tweaking a bit the code that I provided in my answer, you could remove Add to Wishlist button from related

    Here an example of code that should work for your case:

    if( ! function_exists( 'yith_wcwl_selectively_hide_add_to_wishlist' ) ) {
    	function yith_wcwl_selectively_hide_add_to_wishlist( $show ) {
    		global $woocommerce_loop;
    
    		if( $woocommerce_loop && isset( $woocommerce_loop['name'] ) && 'related' == $woocommerce_loop['name'] ){
    			$show = false;
    		}
    
    		return $show;
    	}
    
    	add_filter( 'yith_wcwl_show_add_to_wishlist', 'yith_wcwl_selectively_hide_add_to_wishlist' );
    }
    

    Hope this helps

    Thread Starter alexio

    (@alexio)

    Thank you, i will give it a try. I rated the plugin 5 stars because you set an amazing standard for support!

    @alexio If you give the related products container a custom css class, you can then add the following css code and remove the wishlist button (or icon) from just that loop.

    .custom-class {
    display: none;
    }

    The ‘ display: none; ‘ css code will remove that class and prevent it from loading, versus the css code ‘visibility: hidden’ and ‘content: none;’ as those just hide the class, display:none will prevent it from visually loading altogether.

    Change .custom-class to the custom css class you assign to the Related Products container or section if using a builder like Elementor or Beaver Builder.

    If you are not using a custom page builder (where its easy to assign custom classes to sections) then you can always edit the related-products.php file inside your themes templates folder (depending on theme, could be located somewhere else in the themes directory).

    If you need furthur help, let me know.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove from Related Products’ is closed to new replies.