- This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hide add to cart from shop page. You can add 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 add 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/
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.
.cart{display:none;}
.woocommerce .products .shop-column.product-hover-style-2 .product-content
.product-add-to-cart-btn{
display:none !important;
}
Reference : https://www.ithemesforests.com/how-to-hide-or-remove-add-to-cart-button-in-woocommerce/