Site logo

Archived topic

Cart Icon display

3 replies · Started by Alan Gautham on September 26, 2019

Viewing posts 1–4 of 4

Using the below snippet from this forum to hide cart icon when it is empty.

add_filter( 'generate_woocommerce_menu_item_location', 'tu_hide_empty_cart_icon' );
function tu_hide_empty_cart_icon( $location ) {
    if ( class_exists( 'WooCommerce' ) && sizeof( WC()->cart->get_cart() ) > 0 ) {
        return $location;
    }

    return 'none';
}

ISSUE: When adding product from single product page, cart icon appears.
But when adding products from shop page or category page. Cart icon appears only after manually refreshing the page.
It would be great if it appears instantly as like single product page.
Thank you.

Hi David

That CSS did the job perfectly. Thanks a lot.
Also, Thank you for your niche template which I am using on this site. Your custom tweaks look great on shop pages. Nice detailed work!

Awesome - and thank you for the feedback really nice to hear that - made my day.

This archived topic is closed to new replies.