Disable Show number of cart items on favicon

This topic has 2 replies, 2 voices, and was last updated 7 years, 1 months ago ago by Olga Barlow

  • Avatar: watcha
    watcha
    Participant
    October 9, 2017 at 09:02

    Hi,

    Can you please help to disable the show number of cart items on favicon when there is no product in cart please? I want the number of item to show only when there’s a product added to cart.

    FYI I have already toggled the option to off on Header settings however that doesn’t seem to be working.

    https://prnt.sc/gv271v

    Let me know if you have any questions.

    Thank you.

    1 Answer
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    October 9, 2017 at 16:17

    Hello,

    Add the following code in child theme functions.php

    function etheme_cart_number() {
    		global $woocommerce;
    		?>
    		<?php if ( $woocommerce->cart->cart_contents_count > 1 ): ?>
    			<span class="badge-number number-value-<?php echo $woocommerce->cart->cart_contents_count; ?>" data-items-count="<?php echo $woocommerce->cart->cart_contents_count; ?>"><?php echo $woocommerce->cart->cart_contents_count; ?></span>
    		<?php endif;
    	}

    Regards

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.