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 website:
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' );
}
How can I tweak it, so it only removes the button on woocommerce shop and catagory pages?
To remove the "Add to cart" button You need to use hook which not affect other code-
this will remove add to cart button from shop/category pages .
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.
Hope that would work for you, if not let me know i will guide you
Here is a plugin you can use to remove hide disable add to cart button https://wordpress.org/plugins/woo-options/
This could also be done with CSS by targeting the relevant classes:
In my case there is that avia because i use Enfold Theme. With inspect element find out your class where the buton is located. and declare it invisible.
Another example is:
You can use the Woocommerce conditional tags to check: http://docs.woothemes.com/document/conditional-tags/