I am trying to hide my cart when it is empty, so I decided to add a CSS class to the cart HTML item when the cart is empty, here is my current code:
function x_woocommerce_navbar_menu_item( $items, $args ) {
if (WC()->cart->cart_contents_count == 0 ) {
echo '<script type="text/javascript">
$(document).ready(function() {
$("#header_cart").addClass("zero");
});
</script>';
}
I am adding this to my functionts.php file
Am I missing anything?