Hide Categories
-
Found the following code to hide categories from the Wishlist button. However, nothing happens when I save it.
if ( ! function_exists( 'yith_wcwl_show_add_to_wishlist_button_exclude_categories' ) ) { function yith_wcwl_show_add_to_wishlist_button_exclude_categories( $show ) { global $product; $excluded_categories = array( 'gazebos', 'pergolas', 'quote-services', 'playsetservices', 'basketball-goals', 'trampolines', 'shed-services', ); $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_exclude_categories', 10, 1 ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Hide Categories’ is closed to new replies.