• Resolved Sarah Cauble

    (@sarahnoni)


    Is it possible to hide the # and word “items” if the cart is empty? It seems odd to display that if there are zero items in the cart.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @sarahnoni

    Try this:

    add_filter('wp_head', 'wpo_menu_cart_custom_a');
    function wpo_menu_cart_custom_a()
    {
    	global $woocommerce;
    	$items = $woocommerce->cart->get_cart();
    	if( count($items) == 0 || empty($items) ) {
    		?>
    		<style>
    			li.wpmenucartli a.wpmenucart-contents span.cartcontents { display: none !important; }
    		</style>
    		<?php
    	}
    }

    If you never worked with filters please read our documentation on: How to use filters

    • This reply was modified 4 years, 5 months ago by alexmigf.
    • This reply was modified 4 years, 5 months ago by alexmigf.
    • This reply was modified 4 years, 5 months ago by alexmigf.
Viewing 1 replies (of 1 total)
  • The topic ‘Hide # and items if cart is empty?’ is closed to new replies.