Support » Plugin: YITH WooCommerce Wishlist » How to remove wishlist button?

  • Resolved mayanksdudakiya


    Hey, I would like to remove the wishlist button for particular products.

    Forex. If product has a particular category or taxonomy then the button shouldn’t show on the product listing or a single page.

    Thank you 🙂

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


    Hi there

    I will add a new filter in next version of the plugin, that will allow you to selectively hide Add to Wishlist button

    The filter will be named yith_wcwl_show_add_to_wishlist and you should be able to use it as follows:

    if( ! function_exists( 'yith_wcwl_selectively_hide_add_to_wishlist' ) ) {
    	function yith_wcwl_selectively_hide_add_to_wishlist( $show ) {
    		 * @var $product \WC_Product
    		global $product;
    		if ( $product instanceof WC_Product && has_term( 'tshirts-clothing', 'product_cat', $product->get_id() ) ) {
    			$show = false;
    		return $show;
    	add_filter( 'yith_wcwl_show_add_to_wishlist', 'yith_wcwl_selectively_hide_add_to_wishlist' );

    In this example, I’m removing Add to Wishlist button from any product that has tshirts-clothing category
    Plese, note that this will properly work only when Add to Wishlist buttons are added by our plugin

    If you want to test this change right now, download this file and upload it on your server under wp-content/plugins/yith-woocommerce-wishlist/includes, overwriting previous version
    Plese, make sure to perform this test on a staging environment, to avoid causing any issue to your production site

    • This reply was modified 1 year, 4 months ago by YITHEMES.
    Thread Starter mayanksdudakiya


    Hey @yithemes ,

    Thank you for the quick reply and solution.

    Plugin Author YITHEMES


    You’re welcome!

    We are doing our best to improve our plugins. Our target is to develop and release the best free plugins for WooCommerce, but to achieve this we need your help. Please leave a good review to support us and help our growth 🙂

    Thread Starter mayanksdudakiya


    Hello @yithemes,

    I have applied your solution. But didn’t work.

    1) I have a single product page where I have added yith wishlist button by using shortcode “[yith_wcwl_add_to_wishlist]”.
    2) Then I have replaced the file that you provided me into the plugin
    3) Added above filter code into the function.php file.
    4) For testing, I have changed the CPT terms. I have also added die() function to test the function but function was not calling. There are no any errors in my error log file.

    Please help me. Thanks in advance.

    Plugin Author YITHEMES


    Hi again

    I’m afraid that the problem is that you’re adding Add to Wishlist button using shortcode; in this case, there won’t be any check, and system will just replace shortcode with proper HTML

    If you want to use the solution that I provided before, you’ll need to use PHP in order to print Add to Wishlist button

    For example, you could use the following code

    <?php function_exists( 'YITH_WCWL_Frontend' ) && YITH_WCWL_Frontend()->print_button(); ?>

    inside your template, in order to print Add to Wishlist button; this will also perform check over category, and will output button only when required

    Hello @yithemes, I am interested in trying this out also. I have the same need for hiding the ‘add to wishlist’ button on a few products in certain categories and this seems like it would work for me. Is this option available in the plugin yet?


    Plugin Author YITHEMES


    Hi @phoebem13

    yes, the filter is available within the plugin since version 3.0.7

    @yithemes It worked, thank you!

    Hi. I’m on 3.0.15 and cannot see this functionality. Can you please let me know where it is?

    I could add the code above (yith_wcwl_show_add_to_wishlist), but not sure which file to add it to as you don’t mention the file name.

    Many thanks


Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to remove wishlist button?’ is closed to new replies.