I was wondering if there is a way to hide the cart in the header menu when it is empty?
On our previous theme we used CSS to do this, however it is no longer working that way.
Thanks,
Ryan
I’m using the Flatsome theme.
The code:
function remove_add_cart(){
global $product;
if ( !is_user_logged_in() ) {
// removing the purchase buttons
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’ );
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );
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 );
remove_action( ‘woocommerce_simple_add_to_cart’, ‘woocommerce_simple_add_to_cart’, 30 );
remove_action( ‘woocommerce_grouped_add_to_cart’, ‘woocommerce_grouped_add_to_cart’, 30 );
remove_action( ‘woocommerce_variable_add_to_cart’, ‘woocommerce_variable_add_to_cart’, 30 );
remove_action( ‘woocommerce_external_add_to_cart’, ‘woocommerce_external_add_to_cart’);
remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_external_add_to_cart’, 30 );
remove_action( ‘woocommerce_single_variation’, ‘woocommerce_single_variation’, 10 );
remove_action( ‘woocommerce_single_variation’, ‘woocommerce_single_variation_add_to_cart_button’, 20 );
remove_action( ‘woocommerce_widget_shopping_cart_buttons’, ‘woocommerce_widget_shopping_cart_button_view_cart’, 10 );
remove_action( ‘woocommerce_widget_shopping_cart_buttons’, ‘woocommerce_widget_shopping_cart_proceed_to_checkout’, 20 );
remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’, 10 );
// Remove price
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 );
remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’ );
return WooCommerce::instance();
}
}
add_action( ‘wp’, ‘remove_add_cart’ );
I am currently running a premium vantage theme and using woocomerce as the portal for the store. I noticed that when I select ‘Hide if cart is empty’ option, the cart is still visible. Can you please let me know if there is something I need to do to enable this feature.
Thanks
https://www.ads-software.com/plugins/woocommerce/
]]>https://www.ads-software.com/plugins/woocommerce/
]]>Can any one hel me?
Thanks
]]>I thought about two improvements for this wonderful plugin:
1 – Indicate more precisely how to hide the cart. Perhaps with an icon (cross)?
2 – A message to notify the customer that a product has been added in the basket.
Cheers,
Kler
https://www.ads-software.com/plugins/wp-spreadplugin/
]]>Thanks in advance!
Tom