Support Center
Visit Demo
License manager
Buy @ envato
toggle menu
Categories
Discussions
Activity
Sign In
·
Register
Sign In
·
Register
Categories
Discussions
Activity
Sign In
·
Register
×
Home
›
WooCommerce
How to hide cart if empty?
yakuza2611
March 2017
in
WooCommerce
Hey
How to hide cart if empty?
Thanks
Comments
Bryan
March 2017
Hi,
You cannot hide the cart while empty.
thanks
yakuza2611
March 2017
i mean the cart icon in header
Bryan
March 2017
You want to hide it if the cart is empty or just hide it?
yakuza2611
March 2017
i want to hide the cart icon in header (next to menu) if there is nothing in it (empty)
Bryan
March 2017
Yes, there is no option for that. Sorry
yakuza2611
March 2017
add_action( 'wp_footer', 'x_hide_cart' );
function x_hide_cart(){
if ( WC()->cart->get_cart_contents_count() == 0 ) {
?>
<style type="text/css">a#header_cart{display: none !important;}</style>
<?php
}
}
that's the code - i tried myself
Bryan
March 2017
Yes, we know that this can be done but we do not support such file changes.
Glad you worked it out.
Sign In
or
Register
to comment.
Comments