WooCommerce hide add to cart on shop page

Today we talk about WooCommerce or WordPress hide or remove add to cart on shop page programmatically. In this tutorial, We focus on how to hide/remove add to cart on the shop page.

Let’s start with our example.

add_action( 'woocommerce_after_shop_loop_item', 'qaisar_satti_remove_addtocart', 1 );

function qaisar_satti_remove_addtocart() {
  remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
}

If you want check with only the category listing page and shop page. You can use the following check.

     if( is_product_category() || is_shop()) {
      remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
     }

Qaisar Satti

Hi, I'm Qaisar Satti! I've been a developer for over 20 years, and now I love sharing what I've learned through tutorials and guides. Whether you're working with Magento, PrestaShop, or WooCommerce, my goal is to make your development journey a bit easier and more fun. When I'm not coding or writing, you can find me exploring new tech trends and hanging out with the amazing developer community. Thanks for stopping by, and happy coding!