skip to Main Content
Our free WordPress themes are downloaded over 3 MILLION times. Get them now!

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Remove WooCommerce Cart in Navigation for WordPress theme #130749

    alexanderbiscajin
    Participant

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

    For reference you can see https://www.wpblog.com/add-to-cart-button-in-woocommerce-store/

Viewing 1 post (of 1 total)
Disclosure: This page contains external affiliate links that may result in us receiving a commission if you choose to purchase mentioned product. The opinions on this page are our own and we don't receive additional bonus for positive reviews.
Back To Top