:::: MENU ::::

WooCommerce hide add to cart on shop page

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');
     }
Author: Qaisar Satti
Last Modified: July 14, 2021


Comments are closed.