Woocommerce directory schema

Several ways to delete and hide WooCommerce buttons added to shopping cart

Foreign trade station construction A large number of enterprises are engaged in 2B business and do not need to use WooCommerce's online order Add to cart and price functions, also known as Catalog Mode. So the father of this article will share several methods to remove Add to cart and price.

Method 1: Use plug-ins

YITH WooCommerce Catalog Mode

 Hide WooCommerce shopping cart features

YITH WooCommerce Catalog Mode is a WordPress plug-in, which is mainly used to enable the catalog mode for WooCommerce, hide the add to shopping cart and checkout button.

The usage method is simple. Download and install the plug-in, and then enter the plug-in settings to open the corresponding options.

Download address

MMWD Remove Add To Cart for WooCommerce

This plug-in can also help us hide the content added to the shopping cart and price. After installing the plug-in, you can set it in the WooCommerce settings, products, and Remove Add to Cart tags.

Download address

Method 2: Hidden in the theme setting

 Theme Add to Cart Button

Here with Astra Pro Theme For example, after the WooCommerce function is activated in the theme options, enter the theme customization settings, you can see the options of the store product structure, and close the functions added to the shopping cart.

Usually, some advanced WordPress themes have these settings. You can look for the settings carefully.

Method 3: Use code

If your theme does not support hiding and you do not want to use plug-ins to hide it, you can use the following two codes to remove the shopping cart button.

Code 1 : Directly set the product to non purchasable status

 add_filter( 'woocommerce_is_purchasable', '__return_false');

Code 2 : Remove the add to cart button

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

Code 3: Remove Price

 remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
 //Another way to remove prices add_filter( 'woocommerce_get_price_html', 'naibabiji_remove_price'); function naibabiji_remove_price($price){  return ; }

Code 1 directly sets the product as non purchasable. Compared with code 2, it may have better compatibility, because code 2 directly deletes the corresponding hook. Some topics may have bugs displayed on the interface.

Through these three methods, we can use WordPress and WooCommerce to build a 2B website for product display, isn't it simple?

Updated August 13, 2021:

Method of retaining variant product information and deleting shopping cart button

Same way of using code

 add_action( 'woocommerce_single_product_summary', 'hide_add_to_cart_button_variable_product', 1, 0 ); function hide_add_to_cart_button_variable_product() { //Only delete the shopping cart button and quantity, and keep the variation remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 ); }

If you haven't installed your own website, please refer to the one shared by the father: Steps to build your own website and WordPress Installation Tutorial

Related content

Now that you have seen the content of removing and adding to the shopping cart, you may also be interested in the following article.

5/5 - (2 votes)
Scroll to top