Home

Thursday, January 2, 2014

WooCommerce : How to Disable Shopping Cart Function

Step : 1 :-  Open header.php file of your current theme and Add this css code.

/*disabled shopping cart function for woocommerce*/
#wrap_all .sub_menu {
 display:none;
}
 
.woocommerce-message {
 display:none;
}
 
.thumbnail_container div.thumbnail_container_inner a.product_type_variable,
.thumbnail_container div.thumbnail_container_inner a.product_type_simple {
 display:none;
}
 
.quantity {
 display:none;
}
 
.summary button {
 display:none;
}
 
.summary button[type="submit"] {
 display:none;
}
 
.cart_dropdown {
 display:none;
}
 
/*Custom styling for Mystile theme*/
ul.nav li.cart a,
ul.nav li.checkout a {
display:none;
}
  

Step : 2 :-  Open function.php file of your current theme and Add this hook code.
 
// Remove add to cart button on the navigation bar
remove_action( 'woo_nav_after', 'wootique_cart_button', 10);
remove_action( 'woo_nav_after', 'wootique_checkout_button', 20);
 
// Remove add to cart button from the product loop
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10, 2);
 
// Remove add to cart button from the product details page
remove_action( 'woocommerce_before_add_to_cart_form', 'woocommerce_template_single_product_add_to_cart', 10, 2);
 
//disabled actions (add to cart, checkout and pay)
remove_action( 'init', 'woocommerce_add_to_cart_action', 10);
remove_action( 'init', 'woocommerce_checkout_action', 10 );
remove_action( 'init', 'woocommerce_pay_action', 10 );
 
// check for clear-cart get param to clear the cart
add_action( 'init', 'woocommerce_clear_cart_url' );
function woocommerce_clear_cart_url()
{   
    global $woocommerce;
    $woocommerce->cart->empty_cart();   
}
 

2 comments:

  1. My family members every time say that I am killing
    my time here at net, however I know I am getting experience
    everyday by reading thes good articles or reviews.

    Review my page :: klimatyzacje

    ReplyDelete
  2. Thank you for sharing excellent information. Your website is very cool. Fully useful your blog post... Online shopping website in india

    ReplyDelete

rathoddhirendra.blogspot.com-Google pagerank and Worth