How To Hide Add To Cart Button In The Woocommorce

Woocommerce provides action and filter for modifying add to cart button.

There are two ways to hide add to cart button.

  1. We can use this action.
    Add this code to the functions.php file

    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', 30 );

    This action hides the “add to cart” button for all types of products.

  2. 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:

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories