Hide Cart Icon if no items are in Cart
Hello,
I would like to only show the cart icon if there are products in the cart.
The approach I am attempting to take is to add a body class if there are products in the cart. (ie. 'woocommerce-items-in-cart')
I am trying the below function in the "Theme Functions" file within the child theme with no success. It does not add a class to the body. Can you help me figure out why?
REF URL: http://209.133.215.139/~wwwdumps/ (note: site is in development)
/* ---------------------------------------------------------------------------
* Add Body Class if items are in cart |
* --------------------------------------------------------------------------- */
add_filter(‘body_class’, ‘pwm_woocommerce_cart_status’);
function pwm_woocommerce_cart_status( $classes ){
global $woocommerce;
if( $woocommerce->cart->cart_contents_count > 0 ):
$classes[] = ‘woocommerce-items-in-cart’;
endif;
return $classes;
}
Thanks!
Comments
what you ask for, requires files customization what in reference to Item Support Policy is not allowed. So if you want to modify files and don't know how, you should contact with your web developer.
Thanks for udnerstanding!