Jump to content
alexanderbiscajin

How To Hide or Disable Add To Cart Button In WooCommerce Store

Recommended Posts

alexanderbiscajin

Hide add to cart from product pages. You can use this code in woocommerce.php (located wp-content/plugins/woocommerce):

`function WpBlog() {

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

return WooCommerce::instance();

}`

And for the specific product pages you can hide add to cart button by adding the code in functions.php

`add_filter('woocommerce_is_purchasable', 'wpblog_specific_product');

function wpblog_specific_product($purchaseable_product_wpblog, $product)
{
return ($product->id == specific_product_id (512) ? false : $purchaseable_product_wpblog);

}`

Reference: https://www.wpblog.com/add-to-cart-button-in-woocommerce-store/

Share this post


Link to post
Share on other sites
edgarcheverier

Thank you for the information Alexander! 

  • Like 1

Share this post


Link to post
Share on other sites
alexanderbiscajin
On 11/11/2017 at 3:32 AM, edgarcheverier said:

Thank you for the information Alexander! 

Welcome :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×