• Resolved leisureinstalls

    (@leisureinstalls)


    I also have the YITH Wishlist plugin installed. I am using the following code to limit what product categories show the wishlist. It works in all other parts of the store except the carousel. Can you help me edit it?

    /*Exclude Wishlist on Specific Categories */
    if ( ! function_exists( 'yith_wcwl_show_add_to_wishlist_button' ) ) {
    	function yith_wcwl_show_add_to_wishlist_button( $show ) {
    		global $product;
    
    		$excluded_categories = array(
    			'installation','you_buy_we_install', 'gazebos', 'quote-services', 'basketball-goals', 'playsetservices', 'gazebos', 'trampolines', 'shed-services', 'pergolas',
    		);
    		$product_categories = wp_get_post_terms( $product->get_id(), 'product_cat' );
    		$product_categories = $product_categories ? wp_list_pluck( $product_categories, 'slug' ) : array();
    
    		if ( array_intersect( $excluded_categories, $product_categories ) ) {
    			return false;
    		}
    
    		return $show;
    	}
    	add_filter( 'yith_wcwl_show_add_to_wishlist', 'yith_wcwl_show_add_to_wishlist_button', 10, 1 );
    }
    
    php?>

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Armando

    (@geckod22)

    Hi,
    I just tested your code in my installation and it is working perfect, so I cannot replicate any issue on product slider, the add to wishlist button not show on excluded categories.

Viewing 1 replies (of 1 total)
  • The topic ‘Wishlist Icon Showing in Product Carousel’ is closed to new replies.