How to use filter to disable adding a product to wishlist?

I am using a plugin on my website that made the following filter available:

Added filter ‘tinvwl_allow_addtowishlist_single_product’ that helps to
show/hide the “Add to Wishlist” button for specific products on a
single products page

The filter comes into place here:

if ( empty( $this->product ) || ! apply_filters( ‘tinvwl_allow_addtowishlist_single_product’, true, $this->product ) ) {
return;
}

I would now like to add this filter to a single product page to disable the “add to wishlist” functionality in some cases, but

Where should I hook this filer? Should this be hooked at woocommerce_before_single_product as found on https://businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/ ?
Which arguments do I need in order to pass the false option?
How to add the filter statement correctly in my functions.php file?

Read more here:: How to use filter to disable adding a product to wishlist?

Leave a Reply

Your email address will not be published. Required fields are marked *