Hi there 👋
Upon searching on the internet, I could find a custom PHP code that will allow you to hide the Add to Cart button to non-login users. I’ve tried it and it worked great! Here is a direct link to the code:
https://stackoverflow.com/a/59118057/15592226
After applying the code, it should look like this:
https://www.screencast.com/t/woNYGOBVVr
And, it looks like this when clicking on the read more button:
https://www.screencast.com/t/As2mppVZ
Also, you could use the Catalog Visibility Options plugin for this and much more!
https://docs.woocommerce.com/document/catalog-visibility-options/
Cheers! 🙂
Hi, thanks for the message.
I have tried the code.
This code seems to only work for single product (no variations). The “add to cart” button did disappear when I am logout.
However, I also have products with variations, the “add to cart” button is still there.
However, I also have products with variations, the “add to cart” button is still there.
Yes, it shows the add to cart button for variations, but it doesn’t allow you to purchase the item. It will display a prompt “Sorry, this product is unavailable.”
https://www.screencast.com/t/3QKBPlpVY
Perhaps, there is some kind of conflict going on your site that prevents that the code works for the variable products.
Well, this is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.
I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.
You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.`
If you do require more help with the actual coding, we’d recommend you hire a developer who can take a look at this, quote you for their services, and help you add this feature to your site. We’d recommend getting in touch with a web developer or one of the customization experts listed at https://woocommerce.com/customizations/.
Cheers.
We are happy to help 😃
Great! If you have any further questions, you can start a new thread.
Cheers!