Woocommerce - How to remove the Add to Cart Button on product listing

23,276

I don't know how to do it from WooCommerce but with following code it is possible, just make sure that these PHP code should execute, so, put it at suitable place in PHP file where some PHP codes are executing, best place would be any wordpress plugin's base file, be careful while updating that plugin as these code will get lost after updating.

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

function remove_add_to_cart_buttons() {
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
}
Share:
23,276
user713075
Author by

user713075

Updated on October 24, 2020

Comments

  • user713075
    user713075 over 3 years

    I'm wanting to remove the Add to Cart Button on the product listing pages. The only place I want it to appear is the individual product page. Can anyone suggest on where I can find to remove this? I haven't been able to get any help from the documentation.

    At the moment the button appears under every listing.

  • LobsterMan
    LobsterMan over 11 years
    I've noticed that woo commerce over-uses hooks (this should of been in the theme file and not in a hook. Any tip on how to find what actions/filters are registered for a hook?
  • Ryan S
    Ryan S over 10 years
    It is registered to "woocommerce_after_shop_loop_item" action
  • Nate Flink
    Nate Flink over 9 years
    I wanted to also remove the cart icon from the nav bar and I used this code: stackoverflow.com/questions/25791043/…