Woocommerce provides action and filter for modifying add to cart button.
There are two ways to hide add to cart button.
- We can use this action.
Add this code to the functions.php fileremove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart'); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
This action hides the “add to cart” button for all types of products.
- We can use this filter.
Add this code to the functions.php file.add_filter('woocommerce_is_purchasable', '__return_false');
This filter hides the “add to cart” button for simple products and for a variable product it setting only as a disabled button.
Add to cart button display like for variable product: