Uncategorized

Remove or hide add to cart button in WooCommerce 

Remove add to cart button from all pages and disable purchase functionality

add_filter( 'woocommerce_is_purchasable', '__return_false'); // DISABLING PURCHASE FUNCTIONALITY AND REMOVING ADD TO CART BUTTON FROM NORMAL PRODUCTS
remove_action('woocommerce_single_variation', 'woocommerce_single_variation', 10); // REMOVING PRICE FROM VARIATIONS
remove_action('woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20); // REMOVING ADD TO CART BUTTON FROM VARIATIONS

Hide add to cart button from shop page/archive while keeping purchase functionality

function react2wp_is_shop_remove_add_to_cart_button() {
   if ( is_shop() ) {
      add_filter( 'woocommerce_is_purchasable', '__return_false' );
   }
}

add_action( 'wp_head', 'react2wp_is_shop_remove_add_to_cart_button' );

Leave a Reply

Adblock Detected

Please Disable your Ads blocker.