Hide 'add to cart' button ONLY on woocommerce shop/category pages

前端 未结 7 701
广开言路
广开言路 2021-01-03 15:56

I want to hide the button on my shop pages, but I would like to show it on other posts and pages.

I\'ve found this code to hide the add to cart button on my whole we

7条回答
  •  暖寄归人
    2021-01-03 16:33

    That's quite simple as i have gone through several tutorials when i was trying to fix it . You have to just put this code in woocommerce.php to hide add to cart button for shop page.

    function WpBlog() {
      remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
      remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart');
      return WooCommerce::instance();
    }
    

    Hope that would work for you, if not let me know i will guide you

提交回复
热议问题