Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide wishlist button on specific product #23

Open
PatKlat opened this issue Nov 25, 2020 · 2 comments
Open

Hide wishlist button on specific product #23

PatKlat opened this issue Nov 25, 2020 · 2 comments

Comments

@PatKlat
Copy link

PatKlat commented Nov 25, 2020

Is it possible to deactivate the wishlist button on a specific product?

Thanks
Best regards,
Patric

@codigomaye
Copy link

codigomaye commented Nov 15, 2021

You could do it with a JS/jQuery script and regex.
Ex: Your product is a Gucci Bag. To hide it in single page product
if (/gucci-bag/.test(window.location.href)) { // To hide it jQuery("alg-wc-wl-btn-wrapper").hide() // To remove it from HTML jQuery("alg-wc-wl-btn-wrapper").remove() }

If you want to hide it from product listing:
jQuery(".woocommerce-loop-product__title").each(function(){ var product = new RegExp(jQuery(this).text()); if (product.test(/Gucci Bag/)){ jQuery(this).parent().siblings( ".alg-wc-wl-btn-wrapper" ).hide() } })

@pablo-sg-pacheco
Copy link
Contributor

pablo-sg-pacheco commented Feb 3, 2022

Hi,

Thanks for showing some others way of doing it, but I believe there would be 2 easier ways:

  1. You can use the "Hide by tag" option present on the "buttons" settings.

  2. You can use the alg_wc_wl_show_default_btn and alg_wc_wl_show_thumb_btn filters.
    They both accept 2 parameters $show and $product_id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants