London Escorts sunderland escorts www.asyabahis.org www.dumanbet.live www.pinbahiscasino.com sekabet.net www.olabahisgir.com maltcasino.net faffbet-giris.com www.asyabahisgo1.com www.dumanbetyenigiris.com www.pinbahisgo1.com sekabet-giris2.com www.olabahisgo.com www.maltcasino-giris.com www.faffbet.net betforward1.org betforward.mobi 1xbet-adres.com 1xbet4iran.com romabet1.com www.yasbet2.net 1xirani.com www.romabet.top 3btforward1.com 1xbet https://1xbet-farsi4.com سایت شرط بندی معتبر betforward
HomeWoocommerceHow to Hide or Remove Add to cart button in WooCommerce

How to Hide or Remove Add to cart button in WooCommerce

How to Remove Add to cart button in WooCommerce Using Plugin

You can use “Remove Add to cart” Plugin. You can do the following with this plugin.

  • Woocommerce basic configurations,
  • Disable add to cart
  • Show message insetd of add to cart button
  • Remove Add to cart
  • Chnage Add to cart text
  • Proceed to checkout text change

How to Remove Add to cart button in WooCommerce

So, to remove add to cart button from product detail page and shop page i.e. product listing page all we need to do is to add these two hooks.

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 );

We can place this code in any place where it should be appropriate.

How to remove the Add to Cart button from a specific product Only?

There are a couple of ways to do that, depending on the desired result:

1- You could simply empty the price fields. The product will no longer have a price, nor an Add to cart button.
2- You could enable stock management, and set the product stock to zero.
3- You could write a filter for the “woocommerce_is_purchasable” hook, and return false when the product ID is the target one. This would leave the price visible, and display a “product cannot be purchased” note instead of the Add to cart button.

We will achieve the result by going with the Third option that is to add code to the functions.php file of the Child theme.

add_filter('woocommerce_is_purchasable', 'my_woocommerce_is_purchasable', 10, 2);
function my_woocommerce_is_purchasable($is_purchasable, $product) {
        return ($product->id == whatever_mambo_jambo_id_you_want ? false : $is_purchasable);
}

Remove add to cart button from category page while keeping purchase functionality

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

add_action( 'wp_head', 'react2wp_is_shop_remove_add_to_cart_button' );

The same as removing the add to cart button from the shop page with a slight change to remove it from the category page instead. It is possible to use is_shop and is_product_category together, to do that, just change the if to if ( is_shop() ||is_product_category() ).

If you want, you can hide the button on the specific category page(while keeping functionality)

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

add_action( 'wp_head', 'react2wp_is_shop_remove_add_to_cart_button' );

How to Remove Add to cart button in WooCommerce Using CSS

This could also be done with CSS by targeting the relevant classes:

.cart{display:none;}

Another example is:

.woocommerce .products .shop-column.product-hover-style-2 .product-content 
.product-add-to-cart-btn{
    display:none !important;
}
RELATED ARTICLES
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Latest

0
Would love your thoughts, please comment.x
()
x