We don’t have a code snippet ready to go, though it’s theoretically possible with custom CSS. You can add this custom CSS to your site in Appearance > Customize > Additional CSS:
.home .woocommerce ul.products li.product .button {
display: none !important;
}
Alternatively, you can use a plugin like YITH WooCommerce Catalog Mode, Advanced Catalog Mode for WooCommerce, Catalog Visibility for WooCommerce or CatalogX to hide add to cart button. More info: https://woocommerce.com/posts/how-to-use-woocommerce-as-a-product-catalog/
I hope this helps! If you have any other questions, feel free to ask.
Thank you for responding. With some trial and error using different hooks, I was able to remove the add to cart button from [products] and the related products shown on each product page.
Here’s how I did that:
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
Is there any online documentation for more of the hooks to avoid the trial and error method in future? Thanks!!!
I’m glad to hear you were able to find a solution to remove the add to cart button.
Indeed, we do have detailed documentation on WooCommerce hooks available in our WooCommerce Hook Reference. You can find this guide here:
You can also bookmark these visual guides, which might help you customize WooCommerce and your store easily: https://www.businessbloomer.com/category/woocommerce-tips/visual-hook-series/
I hope this helps you avoid the trial and error method for future customization! If you have any other questions, feel free to ask.
Plugin Support
RK a11n
(@riaanknoetze)
Glad to hear you managed to get to bottom of that by removing that hook. If you need to find the appropriate hooks in future projects, you can use the following:
- Look for visual hook pages like the ones created by Business Bloomer (e.g. here and here)
- You can use a plugin like Query Monitor (more information here)
Finally, there are also some visual hook plugins available that’ll highlight the hooks present on a given page, e.g. WP Hooks Finder.
Hope it helps!
@riaanknoetze and @shameemreza thank you both for the hook references. These are incredibly helpful. Bookmarking them all!
